<div id="parent">
<div>a</div>
<div>b</div>
<div>c</div>
</div>
我使用的是固定定位。那么如何使用jquery获取父div中的所有子元素。第一个 child 的 top:100px
和第二个 child 的 top:200px
等等。
最佳答案
试试这个:
$('#parent div').each(function(index){
$(this).css({ top: (100*(index+1))+'px' });
})
关于jquery - 我如何获得子 div 并使用 jquery 设置位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22007735/