Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reload window on resize script

Status
Not open for further replies.

hablablow

Programmer
Sep 9, 2000
115
FR


hi,

i would like to reload the content of a page when the user
resizes the browser window, but not inside the body tag as <body onresize etc...>

but

inside a <script type="text/javascript"> RELOAD ON RESIZE PAGE</script>

Thanks for your interest.

Guida
 
Huh? Like this?

Code:
<script language="javascript">
onresize = function() { document.location = document.location; }
</script>

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
window.onresize=myResizeFunction;

Keep in mind though that this event gets triggered continually as they drag the window borders. If you want it to only execute once when they're done moving it, use a timer:
Code:
var resizeTimer;
window.onresize=function(){
  clearTimeout(resizeTimer);
  resizeTimer=setTimeout('myResizeFunction()',300);
}
function myResizeFunction(){
  alert('You resized me!');
}

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
more on what adam said:

Keep in mind though that this event gets triggered continually as they drag the window borders.

Only in IE.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
I'm kind of curious, if you don't mind, why you want this functionality. There is most likely a more efficient way of doing what you want...

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
I want Ie only to catch the script so i use conditionnal comments like this:

<!--[if IE]>
<script language="javascript">
onresize = function() { document.location = document.location; }
</script>
<style type="text/css" media="screen"
title="currentStyle" >
@import "frameswithoutframes6_ie.css";
</style>
<![endif]-->

Other browsers will ignore this
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top