开发者

What is the best way to make a zoom event automatically trigger a resize event?

I have some resize code, but it does not seem to get triggered for a zoom event. I have had zoom code trigger resize code before, and know a little bit about situations that cause a zoom event to tr开发者_如何转开发igger a resize, however I would like to get more explanation.

What is the best way to force a zoom event Ctrl++ or Ctrl+- to cause a onresize call?


You won't like the answer. I suggest you don't do this. There is no native way to detect it, as in window.onzoom or anything like that. You would have to set up an interval timer and continually do DOM testing of box sizes compared to font sizes. And newer browsers zoom differently than older browsers. IE6 just increases the font size while FF3.5 increases the size of the page and re-wraps to to fit.

The recommendation is to allow the browser to act as intended and set up your CSS styles appropriately with EM tags for sizes.


Sorry guys, I have a solution I like better than either of yours. Basically, make a wrapper div arround all you html source.

<div style="height:100%;width:100%" onresize="youResizeCode()"></div>

It works great for me. I am basically using it for FF3 and IE8, I am not sure which browsers will work with this.

Grae

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜