开发者

JQuery not filter

开发者 https://www.devze.com 2023-02-05 17:17 出处:网络
function() { $(this).animate({ width: 130 }, 300, function() { }); }); 开发者_如何学Python I wanna animate only those li\'s whose width is not 160
function() {
              $(this).animate({ width: 130 }, 300, function() { });
        });
开发者_如何学Python

I wanna animate only those li's whose width is not 160

Thanks


$('li').filter(function() { return $(this).width() != 160 }).animate({ width: 130 }, 300, function() { });

For readability:

jQuery.expr[':'].width = function(e, ix, match) { return $(e).width() == match[3]; };

You may then, at any point, do:

$('li:not(:width(160))').animate({ width: 130 }, 300, function() { });
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号