jquery弹簧式动画拓展
2013-01-20 13:12
260 查看
// 扩展过渡效果到 jQuery jQuery.extend(jQuery.easing,{ def : "easeOutQuad", swing : function(c, a, b, d, e) { return jQuery.easing[jQuery.easing.def](c, a, b, d, e) }, easeOutBounce: function(c, a, b, d, e) { return (a /= e) < 1 / 2.75 ? d * 7.5625 * a * a + b: a < 2 / 2.75 ? d * (7.5625 * (a -= 1.5 / 2.75) * a + 0.75) + b: a < 2.5 / 2.75 ? d * (7.5625 * (a -= 2.25 / 2.75) * a + 0.9375) + b: d * (7.5625 * (a -= 2.625 / 2.75) * a + 0.984375) + b } }); // 实现动画 $(function(){ var springSpeed = 600; // 动画速度 var theSpringHeight = $('.button').offset().top; $('.spring').css({marginTop: -theSpringHeight}); $('.button').toggle(function(){ $('.spring').animate({marginTop: 0}, springSpeed, 'easeOutBounce'); }, function(){ $('.spring').animate({marginTop: -theSpringHeight}, springSpeed, 'easeOutBounce'); }); });
相关文章推荐
- JQuery表单/插件/Ajax/Table/特效/拓展/动画/选择器
- 仿JQuery的show与hide动画函数
- JQuery动画控制元素
- 放弃使用jQuery实现动画
- 30 个 jQuery & CSS3 加载动画和进度栏插件(附免积分下载地址)
- jQuery的自定义动画
- Tweene-超级强大的jQuery动画代理插件
- jQuery的动画-显示和隐藏
- 移动端 transition动画函数的封装(仿Zepto)以及 requestAnimationFrame动画函数封装(仿jQuery)
- JavaScript强化教程——jQuery 动画2
- jQuery实现菜单感应鼠标滑动动画效果的方法
- 06-jQuery动画-1
- 10个超赞的jQuery图片滑块动画
- jquery事件和动画操作集锦
- 基于jQuery点击加载动画按钮特效
- jQuery动画效果
- 超酷jQuery进度条加载动画集合
- jQuery_动画
- 好用的jquery.animateNumber.js数字动画插件
- jquery 的动画与特效