gpt4 book ai didi

jquery - 获取jquery元素数组的坐标

转载 作者:行者123 更新时间:2023-12-01 07:50:00 25 4
gpt4 key购买 nike

我想从匹配的 jquery 数组中提取左坐标数组(简单的数字)。与此类似的东西:

var array = element.nextAll().position().left

有没有一种巧妙的方法可以做到这一点,也许用下划线?

因此,在这种情况下,jquery 数组包含许多 div,我想从每个 div 中获取它们的 jquery position() - 对象并提取左坐标。生成的数组将包含每个 div 左坐标的数字。

最佳答案

请尝试此代码:

array = $(element.nextAll()).map(function() {
return $(this).position().left;
}).get();

请引用此link

关于jquery - 获取jquery元素数组的坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31072773/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com