检索Ruby中HTML元素的位置(x,y)
我有一个示例显示了用户的一些任意文本:
<html>
<head></head>
<body>
<%= @article.text %>
</body>
</html>
我想知道如何获得html元素的x和y位置,例如使用ruby等 @actits.text。
I have this example that displays some arbitrary text from the user:
<html>
<head></head>
<body>
<%= @article.text %>
</body>
</html>
I want to know how to get the X and Y position of HTML elements such as @article.text using Ruby.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将一些ID设置为元素
并使用
getBoundingClientRect
参考:
https:/ https://javascript.info /坐标
Set some id to element
And get position in JS with
getBoundingClientRect
Reference:
https://javascript.info/coordinates