• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1281
  • Last Modified:

onresize with frames

I have a document with 3 frames, and I need to run a function when the user resizes the window.  

Here is how I am handling the event:

<SCRIPT FOR="window" EVENT="onresize" LANGUAGE="JavaScript">
      doFunc();
</SCRIPT>

The problem is, when the window is resized, the function runs 3 times, once for each frame.  How can I get it to only run once?
0
scottarius
Asked:
scottarius
  • 2
  • 2
1 Solution
 
venkateshwarrCommented:
Where did you keep this code?
In a frame or in html file containing frameset?
0
 
scottariusAuthor Commented:
it's in the head of the html file with the frameset.
0
 
venkateshwarrCommented:
Why dont you move this code to one of the html file inside a frame...
0
 
devicCommented:
try this:
-----------------------
<script>
var resizeCaptured=false;
</script>
<SCRIPT FOR="window" EVENT="onresize" LANGUAGE="JavaScript">
if(!resizeCaptured)
{
    resizeCaptured=true;
      doFunc();
      setTimeout("resizeCaptured=false",1000)
}
</SCRIPT>
0
 
scottariusAuthor Commented:
perfect! thanks devic.

i was thinking i might have to set a timeout but wasn't sure the best way to go about it.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now