Wednesday, January 28, 2015

One tricky infinity time animation by jquery

$(document).ready(function(){
$.fn.grow_anim=function(){
$("#anim").animate({paddingLeft: "100px"}, 1000);
$(this).shrink_anim();
}

$.fn.shrink_anim=function(){
$("#anim").animate({paddingLeft: "15px"}, 1000);
$(this).grow_anim();
}

$("#anim").bind("mouseenter",function(){
$("#anim").stop(true);
});

$("#anim").bind("mouseleave",function(){
$(this).grow_anim();
});
});

I am explaining below:

Normally animation running and running but when you put your mouse on that Div or text in that time animation will be stop then again when you leave your mouse pointer from that div or text your animation will be running normally.

try it good luck.

No comments:

Post a Comment

Suomen kieli (Imperfekti)

In Finnish, the imperfekti is the past tense that describes actions that happened in the past, like the English simple past (e.g., "I ...