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.
Is there a way to open a kendo window in a position relative to the button that called it
(I would like to open the window right next to the button that called it.)
用于获取 html 元素的 x 、 y 坐标
offset()
获取第一个匹配元素相对于文档的当前偏移量(以像素为单位)。
position()
获取元素相对于其偏移父元素的顶部和左侧位置。
知道了这一点,那就简单了……(以我的小 svg 项目作为示例页面)
var x = $("#wrapper2").offset().left; var y = $("#wrapper2").offset().top; console.log('x: ' + x + ' y: ' + y);
输出:
x: 53 y: 177