How to Detect Width Change

V

vunet

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
 
V

VK

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.
 
V

vunet

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?
 
T

Thomas 'PointedEars' Lahn

vunet said:
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
 
S

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)">
 
S

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.
Make your div size in em, not px, Firefox will handle that.

how about other Mozilla-based browsers? or Safari?

all my browsers works this way, even my IE (but I am on Mac)

test :

<div style="width:2em;border:1px solid">
blah
</div>
 
V

vunet

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.
Make your div size in em, not px, Firefox will handle that.
how about other Mozilla-based browsers? or Safari?

all my browsers works this way, even my IE (but I am on Mac)

test :

<div style="width:2em;border:1px solid">
blah
</div>

Thanks, that works for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
anuragag27

Latest Threads

Top