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

Workflow of WordPress project in a team with Git

1. We should not push any Wordpress core folders or files to github. 2. Only push custom theme and custom plugin into github. 3. So, in this...