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

detecting and acting on a window resize

P: n/a
Hey Guys

I am able to detect a window resize using the following code:

window.onresize = function () {
if(document.getElementById("parent_for_video").sty le.display !=
"none") {
calculate_positions();

//Resize the main div
gray_div = document.getElementById("gray_div");
gray_div.style.height = h;
gray_div.style.width = w;

main_div = document.getElementById("main_div");
main_div.style.height = video_overlay_height;
main_div.style.width = video_overlay_width;
main_div.style.top = video_overlay_top;
main_div.style.right = video_overlay_right;
}//if(document.getElementById("parent_for_video").sty le.display !=
"none")
}//window.onresize = function ()

You should be able to see that when a resize is detected i move and
resize a couple of divs.

The thing is though i cant work out how to do this in real time. That
is the calculations only happen when i let go out the mouse. So if i
resize from massive to small the changes dont get reflected untill i
stop dragging the mouse.

I'd like to be able to resize and stuff as the mouse is dragging the
dimensions.

Hope that makes sense and someone can help

Cheers

Andy

Oct 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
daveyand said the following on 10/25/2006 12:11 PM:
Hey Guys

I am able to detect a window resize using the following code:
<snip>
The thing is though i cant work out how to do this in real time. That
is the calculations only happen when i let go out the mouse. So if i
resize from massive to small the changes dont get reflected untill i
stop dragging the mouse.
A while back, the browsers fired the onresize event every pixel it got
resized. Every time you moved 1 pixel, the event got fired. It got very
annoying if an alert was thrown up! Now, it has been changed where
onresize fires like onresizeend does in IE - after the browser has been
completely resized.
I'd like to be able to resize and stuff as the mouse is dragging the
dimensions.
You can't anymore.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 25 '06 #2

P: n/a
I'd like to be able to resize and stuff as the mouse is dragging the dimensions.
You can't anymore.
Damn.

Oh well. Thanks.

I guess i could always do a setTimeout() situation. But no point
really.

Oct 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.