detecting and acting on a window resize

D

daveyand

Hey Guys

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

window.onresize = function () {
if(document.getElementById("parent_for_video").style.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").style.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
 
R

Randy Webb

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:

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.
 

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
473,773
Messages
2,569,594
Members
45,117
Latest member
Matilda564
Top