By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,526 Members | 1,888 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,526 IT Pros & Developers. It's quick & easy.

How to Detect Width Change

P: n/a
When user enlarges font with Ctrl+[+] I want to increase the
dimensions of my fixed sized div. IE7 uses zoom-in, so it will
increase div dimensions automatically. Firefox, however, increases
font only, not div element.
I thought to implementing this by checking if my div width or height
changed and then resize it. But this approach did not work:

div.addEventListener('resize', someFunc, false);

Please advise. Thanks
Jan 14 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
VK
On Jan 14, 11:20 pm, vunet <vunet...@gmail.comwrote:
When user enlarges font with Ctrl+[+] I want to increase the
dimensions of my fixed sized div. IE7 uses zoom-in, so it will
increase div dimensions automatically. Firefox, however, increases
font only, not div element.
I thought to implementing this by checking if my div width or height
changed and then resize it. But this approach did not work:

div.addEventListener('resize', someFunc, false);

Please advise. Thanks
Make your div size in em, not px, Firefox will handle that.
Jan 14 '08 #2

P: n/a
On Jan 14, 3:25 pm, VK <schools_r...@yahoo.comwrote:
On Jan 14, 11:20 pm, vunet <vunet...@gmail.comwrote:
When user enlarges font with Ctrl+[+] I want to increase the
dimensions of my fixed sized div. IE7 uses zoom-in, so it will
increase div dimensions automatically. Firefox, however, increases
font only, not div element.
I thought to implementing this by checking if my div width or height
changed and then resize it. But this approach did not work:
div.addEventListener('resize', someFunc, false);
Please advise. Thanks

Make your div size in em, not px, Firefox will handle that.
how about other Mozilla-based browsers? or Safari?
Jan 14 '08 #3

P: n/a
vunet wrote:
On Jan 14, 3:25 pm, VK <schools_r...@yahoo.comwrote:
>On Jan 14, 11:20 pm, vunet <vunet...@gmail.comwrote:
>>When user enlarges font with Ctrl+[+] I want to increase the
dimensions of my fixed sized div. IE7 uses zoom-in, so it will
increase div dimensions automatically. Firefox, however, increases
font only, not div element.
I thought to implementing this by checking if my div width or height
changed and then resize it. But this approach did not work:
div.addEventListener('resize', someFunc, false);
Please advise. Thanks
Make your div size in em, not px, Firefox will handle that.

how about other Mozilla-based browsers?
The correct term is Gecko-based, which also explains why there
will be little difference in rendering between them, if any.
or Safari?
General CSS questions and discussions are beyond the scope of this
newsgroup; comp.infosystems.www.authoring.stylesheet exists. However, all
CSS-capable user agents would support the `em' unit of length, as that is
specified so.
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jan 14 '08 #4

P: n/a
SAM
vunet a écrit :
When user enlarges font with Ctrl+[+] I want to increase the
dimensions of my fixed sized div. IE7 uses zoom-in, so it will
increase div dimensions automatically. Firefox, however, increases
font only, not div element.
I thought to implementing this by checking if my div width or height
changed and then resize it. But this approach did not work:

div.addEventListener('resize', someFunc, false);

Please advise. Thanks

arrange your div in proportional (en ou %)
all will work automatically

I don't think you can detect Control +
and then ... if you can ... how much will you have to grow ?
Since I can have my minimal fonts fixed on 16 or 18px

More ... on Mac it is Command +
What is the code to detect pressure on Command key ?


function detect(Event) {
if(Event==null) {
alert('null');
Event=event;
}
if (Event && Event.ctrlKey) {
if(Event.keyCode=='107') alert('[Control] [+] pressed');
if(Event.keyCode=='109') alert('[Control] [-] pressed');
}
}

<body onkeydown="detect(event)">

--
sm
Jan 15 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.