Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- var over = false;
- $("#map img").each(function() {
- var image_width = this.width;
- var width_change = Math.round(image_width + (image_width*5/100));
- $(this).mouseenter(function(){
- if (over === true)
- {setTimeout(function()
- {
- if (over === false)
- {
- over = true;
- clearTimeout($(this).data('timeoutId'));
- $(this).animate({width: width_change}, 1000);
- }
- }, 3000);}
- else
- {
- over = true;
- clearTimeout($(this).data('timeoutId'));
- $(this).animate({width: width_change}, 1000);
- }
- }).mouseleave(function(){
- var someelement = this;
- var timeoutId = setTimeout(function(){ $(someelement).animate({width: image_width});over = false;}, 3000);
- $(someelement).data('timeoutId', timeoutId); //set the timeoutId, allowing us to clear this trigger if the mouse comes back over
- });
- });
- });
Add Comment
Please, Sign In to add comment