473,509 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Detect Width Change

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
4 8487
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
14517
by: Michael Hill | last post by:
I have a perl script that i use to render a html page. In that page i call out a stylesheet. If the user has a 800x600 display the fonts are really too big. Since screen resolution is a function...
157
16243
by: Dennis | last post by:
Is there some way --using, say, DOM or javascript-- to detect the current pixel width and/or height of a relatively sized table or of one of its columns or rows. I'm going to be writing javascript...
3
7103
by: Asterbing | last post by:
Since the "on fly addition..." thread has taken another direction, I'm opening a new one to be more explicit and recenter the subject. Well, the subject is to detect when a document is well...
3
5123
by: Randy Harris | last post by:
With a multiple column listbox, I'd like to be able to change the sort by allowing the user to click on a column. Is there a practical way detect in which column the user clicked? I know this...
24
2979
by: dE|_ | last post by:
I have started looking into scripts for screen size detect with the intention of using them to pick from a number of CSS style sheets tailored to the size. Is there a good reason why this is not...
1
3229
by: azura | last post by:
how can i get this textfield auto detect?? because i try not to using view name button... i want when i enterd this matric no., the student name will appear automatically when i insert the matric...
0
7233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7135
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7342
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.