Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(document).ready
  2. (
  3.     function($)
  4.     {
  5.         var timeout = null;
  6.         $('.demo-image')
  7.             .mouseenter(function()
  8.             {
  9.                 var $width = $('div.demo-image > img').width() + 20;
  10.                 if ($width > 970) { $width = 965; }
  11.                 var $this = $(this);
  12.                 clearTimeout(timeout);
  13.                 timeout = setTimeout(function()
  14.                 {
  15.                     $this.css('background-color', 'white')
  16.                          .css('position', 'relative')
  17.                          .css('z-index', '1000')
  18.                          .stop(true, true).animate({width: $width}, 'fast');
  19.                 }, 200);
  20.             })
  21.             .mouseleave(function()
  22.             {
  23.                 var $this = $(this);
  24.                 clearTimeout(timeout);
  25.                 timeout = setTimeout(function()
  26.                 {
  27.                     $this.stop(true, true).animate({width : '100%'}, 'fast');
  28.                 }, 250);
  29.             }
  30.         );
  31.     }
  32. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement