我知道这段代码非常蹩脚,但到目前为止它运行良好,所以我保留了它。 但是现在我的
我的问题是; 我怎样才能保留该动画并使其与未定义数量的
这是演示: http://jsfiddle.net/NdRDh/
非常感谢!希望你能帮助我!!
汤姆
最佳答案
我建议:
$(document).ready(
function() {
$('li').each(
function(i) {
$(this)
.delay(400)
.animate(
{
'top' : '10px'
}, 1500 + (500*i));
});
});
哦,请注意,您正在为 所有 li
元素重复相同的 id
:这是无效的 HTML,因为:
id
= name [CS]This attribute assigns a name to an element. This name must be unique in a document.
(引自:http://www.w3.org/TR/html401/struct/global.html#h-7.5.2)
引用资料:
-
each()
.
关于javascript - 未知数量的 <li> 的 jQuery 动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11403748/