Javascript Timers not consistent -


I know that there are many topics on the javascript timer, however, my timers are doubling on my mouse all the time "doubling "To call a div a command, they are not compatible. The following devices show on-homeoverover events that call the function

  & lt; Div id = "Team_Container2" & gt; Div id = "image1" onmouseover = "area_hor1 (this); area_over2 (this)" & gt; & Lt; / Div & gt; & Lt; Div id = "Team_Container2" & gt; Div id = "image2" onmouseover = "area_hor1 (this); area_over2 (this)" & gt; & Lt; / Div & gt; Function area_hur1 (obj) {var interval; ClearInterval (interval); Href = $ (obj) .attr ('href'); Url = href.split ('#'); Url1 = url [1]; Interval = set interval (set (array (set array (document.getElementById (url1), 'seating_ plan_image_canvas', '0,0,0', '0,0,0', '0.33', 0, 0, 0); }, 1000); return;} function area_more 2 (obj) {var interval; href = $ (obj) .attr ('href'); url = href.split ('#'); url1 = url [1]; ClearInterval; interval = set interval (function () (set arrayover (document.getElementById (url1), 'seating_ plan_image_canvas', '0,0,0', '0,0,0', '0.0', 0, 0, 0);}, 2000); return;}   

How can I adjust the timer or merge two functions in one and after the "setInterval" one Showing I can not do this.

I want regional hover 2 set interval to arrive like the first zone_howar 1 set interval, like 500 milliseconds, if it makes sense.

Also help will be most appreciated!

Every time you hover over your image, you close a new setInterval

< Div class = "post-text" itemprop = "text" code>, because your clear interval () command is not actually doing anything you hover The variable holding the setInterval () pointer inside the function is defined, so that when it turns out, the variable goes what you want:

  var Interval; // defined in the field of the Global Scope Function areaHowar1 (OBJ) {clear interval (interval); // Cancel any existing hover interval // set variables interval = set interval (function () {/ * doStuff * /}, 1000); }   

You may also need to capture the onMouseOut event to stop the interval, since the element will still be run after the mouse is played.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -