Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery check hover status before start trigger
    text
    copied!<p>i create a small slider plugin with jquery. the images would slide 5% in from left or right when the mouse is over the left or right controll div. On click the image slides in to 100%</p> <p>the problem is that when move the mouse during the full slide in animation from the left to right control div i coudnt check if the mouse is always over the left div to trigger the mouseover event again. the result is that the image from the left and the from the right is show 5%.</p> <p>Is there a way to check the mouseover like this one?</p> <pre><code>if($(this).mouseover()) $(".right").trigger("mouseover"); </code></pre> <p>the code of a controller div look like this</p> <pre><code> $(".right",this).bind({ mouseover:function(){ if( vars.current == $("img").length-1 || vars.running) return false; $("img:eq("+(vars.current+1)+")").removeAttr("style").css({position:"absolute",left:"100%","z-index":vars.current+1}).show().animate({left:"95%"}, {queue: false}) }, mouseleave:function(){ if( vars.current == $("img").length-1 || vars.running) return false; $("img:eq("+(vars.current+1)+")").animate({left:"100%"}, {queue: false , complete:function(){ $(this).hide() } }); }, click:function(){ if( vars.current == $("img").length-1 || vars.running) return false; vars.running = true; $("img:eq("+(vars.current+1)+")").animate({left:"0%"}, {queue: false, complete:function(){ $("img:eq("+vars.current+")").hide(); $(this).css({"z-index":0}) vars.current++; vars.running = false; if($(this).mouseover()) $(".right").trigger("mouseover"); } } ); } }) </code></pre> <p>i use the way from the other answer... but its deletet....</p> <pre><code>mouseover:function(){ isOver = 'right'; if( vars.current == $("img").length-1 || vars.running) return false; $("img:eq("+(vars.current+1)+")").removeAttr("style").css({position:"absolute",left:"100%","z-index":vars.current+1}).show().animate({left:"95%"}, {queue: false}) }, mouseleave:function(){ isOver = false if( vars.current == $("img").length-1 || vars.running) return false; $("img:eq("+(vars.current+1)+")").animate({left:"100%"}, {queue: false , complete:function(){ $(this).hide() } }); }, click:function(){ if( vars.current == $("img").length-1 || vars.running) return false; vars.running = true; $("img:eq("+(vars.current+1)+")").animate({left:"0%"}, {queue: false, complete:function(){ $("img:eq("+vars.current+")").hide(); $(this).css({"z-index":0}) vars.current++; vars.running = false; if(isOver) $("."+isOver).trigger("mouseover"); } } ); } </code></pre> <p>by using the var isOver i could trigger the left or right</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload