简体   繁体   English

获取相对于整个页面的JQuery位置

[英]Get JQuery position relative to whole page

I'm working on hacking a PDF reader to make some changes, and I want to use JQuery to get positions of some elements such as links. 我正在研究如何破解PDF阅读器以进行一些更改,并且我想使用JQuery来获取某些元素(例如链接)的位置。 I use 我用

jQuery(this).position() jQuery(this).position()

Apparently this gives me the position relative to a page in the PDF, not the entire document! 显然,这给了我相对于PDF中页面的位置,而不是整个文档! So if the element appears at the top of page 9, the "top" position gives a very small value, even though it is down in page 9. Is there a way to get the position relative to the whole document? 因此,如果该元素出现在第9页的顶部,则即使位于第9页的“顶部”位置也给出很小的值。是否有办法获得相对于整个文档的位置?

对此不完全确定,请尝试$(this).offset()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM