我有一个div包含大约100个其他div元素.每个div元素都有top和left属性.如何找到div具有最大left属性的?
我需要最好的表现.谢谢.
尝试这个,
var divWithTopLeft = null;
var maxLeft = 0;
$('div').each(function(){
left = this.style.left.replace('px','');
if(left > maxLeft )
{
maxLeft = left;
divWithTopLeft = this;
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2754 次 |
| 最近记录: |