我叫大王来巡山

导航

 

1.jquery创建插件

jQuery.extend({插件名:函数体,插件名:函数体});

html部分

<div id="div1">开始动画</div>

jquery部分

$(function(){
			$("#div1").click(function(){
				$(this).animate(
					{"left":800},
					6000,
					"easeOutBounce",
					function(){
						$(this).html("动画结束");
					}
					
				);
				
			});
		});

  插件部分

jQuery.extend(jQuery.easing, {
	easeOutBounce: function(x, t, b, c, d)
	{
		if ((t /= d) < (1 / 2.75))
		{
			return c * (7.5625 * t * t) + b;
		}
		else if (t < (2 / 2.75))
		{
			return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
		}
		else if (t < (2.5 / 2.75))
		{
			return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
		}
		else
		{
			return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
		}
	}
});

  

posted on 2017-02-22 18:33  我叫大王来巡山  阅读(131)  评论(0编辑  收藏  举报