[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1280
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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