Guest User

http://bniaulin.wordpress.com/2012/12/10/delay-the-hover-in-

a guest
Dec 11th, 2012
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function($) {
  2. var timer;
  3.  
  4. $(document).ready(function() {
  5.     $('li.static.dynamic-children').unbind('mouseover').unbind('mouseout');
  6.     $('li.static.dynamic-children').hover(function () {
  7.         var li = $(this);
  8.                
  9.     li.css({ 'position': 'relative', 'z-index': '100' });
  10.         li.find('ul.dynamic').css({ 'left': '-1px', 'top': '25px' });
  11.     li.find('ul.dynamic').hide();
  12.         timer = setTimeout(function () {
  13.             li.find('ul.dynamic').show('fast');
  14.         }, 1000);
  15.     }, function () {
  16.     clearTimeout(timer);
  17.     var li = $(this);
  18.         li.css({ 'position': 'absolute', 'z-index': '0' });
  19.         li.find('ul.dynamic').css({ 'left': '-999em', 'top': '0px' });
  20.     });
  21. });
  22.  
  23. }(jQuery));
Add Comment
Please, Sign In to add comment