Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以在方法参数中以某种方式引用当前的 jquery 对象/集合...
例如
$('#sub > :last-child').height($('#sub > :last-child').height() + (gap * -1));
我可以以某种方式更改第二个引用,还是我坚持存储在变量中。
谢谢,
如果您传递一个函数,您可以获得当前值。
$('#sub > :last-child').height(function(i, value) { return value + (gap * -1); });
演示