javascript - Add pause on hover to jQuery -


can assist me in trying pause on hover working example. need following.

  • pause interval on hover
  • highlight item hovered on
  • on hover out resume rotate

code (fiddle demo):

var $f = $('ul').find('.frame'); function recursive(i) {     $f.removeclass('showing').eq(i).addclass('showing');     settimeout(function () {         recursive(++i % $f.length)     }, 1000); } recursive(0); 

working demo

you might need tweak bit fit requirements. idea clear interval on mouse on , resume recursion on mouseout & keep reference count.

var $f = $('ul').find('.frame'),     timeout,      count;   function recursive(i) {     count = i;     $f.removeclass('showing').eq(i).addclass('showing');     timeout = settimeout(function () {         recursive(++i % $f.length)     }, 1000); }  $('ul li').hover(function(){     cleartimeout(timeout); });  $('ul li').mouseout(function(){     recursive(count); });   recursive(0); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -