当前位置:编程学习 > C#/ASP.NET >>

Can you tell me the difference between scrollTop and offsetTop? Reminder, I have

Can you tell me the difference between scrollTop and offsetTop?
Reminder, I have google it so long/ --------------------编程问答-------------------- scrollTop 设置或获取对象顶端和窗体中可见内容的最顶端之间的距离

offsetTop 是相对与版面或者制定坐标的。


属性解释

例子 --------------------编程问答--------------------
引用 1 楼 wxr0323 的回复:
scrollTop 设置或获取对象顶端和窗体中可见内容的最顶端之间的距离

offsetTop 是相对与版面或者制定坐标的。


属性解释

例子

/tks --------------------编程问答-------------------- 装老外啊
--------------------编程问答-------------------- scrollTop,顾名思义,scroll滚动条 ,滚动条顶部滚动的高度
offsetTop,的话就是指元素距离其offsetParent的距离,(根据position值和元素不同,其offsetParent不一定是其parent.) --------------------编程问答--------------------
引用 3 楼 q287551219 的回复:
装老外啊


--------------------编程问答-------------------- 看来CSDN要出英文版了 --------------------编程问答-------------------- scrollTop : 
Get the current vertical position of scroll bar for the current element. The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area. If the scroll bar is at the very top, or if the element is not scrollable, this number will be 0.

offsetTop:
Get the top position in pixel between current element and element which has relative position to it in the DOM page. This poperty only works with visible elements.
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,