简体   繁体   English

如何在一个较长的html页面中获取屏幕的高度位置?

[英]How to obtain the screen's height position in a long html page?

在此处输入图片说明

I have a sliding screen on a long HTML page with left and right columns. 我在带有左右列的HTML长页面上有一个滑动屏幕。 How can I obtain the height position of the screen in the HTML page, knowing users use sliding bars? 在知道用户使用滑动条的情况下,如何获得HTML页面中屏幕的高度位置? I need this to slide the left and right column content to follow users' movement. 我需要它来滑动左右列的内容,以跟随用户的移动。 Thanks. 谢谢。

PS: I am using JQuery (if it helps). PS:我正在使用JQuery(如果有帮助)。

You can use scrollTop to find the vertical scroll position of any DOM element. 您可以使用scrollTop查找任何DOM元素的垂直滚动位置。

$('#element').scrollTop()

Some other useful functions: scrollLeft() , offset() , position() 其他一些有用的函数: scrollLeft()offset()position()

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

相关问题 如何获取相对于HTML页面的标记位置 - How to obtain marker position relative to HTML page 如何发现用户设备屏幕的高度小于页面内容的高度? - How to find out that the height of the user's device screen is smaller than height of page content? 如何在HTML网页中获取Flash的网址,高度,宽度? - how to get flash's url, height, width in a HTML web page? 高度达到页面高度的100%后,如何使html div垂直滚动? - How to make a html div vertically scrollable after it's height reaches 100% height of the page? 获取高度以在绝对模式下定位div - obtain height to position a div in absolute mode 在HTML应用程序中,使用javascript,如何将图像在屏幕上的位置放入文本文档中? - In a Html Application, using javascript, how would I get an image's position on the screen an put it in a text document? 如何使屏幕的下拉菜单高度覆盖页面高度? - How to make dropdown menu height of screen so that it overrides page height? 如何获得在线元素在屏幕上的顶部/左侧位置和高度? - How to get top/left position and height of the in-line element on the screen? "如何计算屏幕高度并将元素定位在折叠下方?" - How to calculate the screen height and position an element below the fold? jQuery自动完成功能:如何获取HTML项目的“ id”属性? - jQuery autocomplete: How to obtain HTML item's “id” attribute?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM