首页 > Web开发 > 详细

jquery抖动的按钮

时间:2015-06-03 13:28:08      阅读:264      评论:0      收藏:0      [点我收藏+]

http://runjs.cn/detail/tyx8dbag

 

//shakenum:抖动的次数,shakeDistance:抖动的距离
jQuery.fn.Shake = function (shakenum , shakeDistance) {
    this.each(function () {
        var jSelf = $(this);
        jSelf.css({ position: ‘relative‘ });
        for (var x = 1; x <= shakenum; x++) {
            jSelf.animate({ left: (-shakeDistance) }, 50)
                .animate({ left: shakeDistance }, 50)
                    .animate({ left: 0 }, 50);
            }
        });
        return this;
    }
        
    
$(function () {
    $(‘#btn‘).click(function () {
        $(this).Shake(2, 10);
    });
});

 

jquery抖动的按钮

原文:http://www.cnblogs.com/q460021417/p/4548618.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!