【发布时间】:2014-06-25 12:08:40
【问题描述】:
当内容位于容器 div 中时,有什么方法可以找出某人滚动了多少位置:relative。当位置设置为绝对时,我似乎只能使用 JavaScript 或 JQuery 获得滚动位置,但这会破坏站点布局。有什么解决办法吗?
【问题讨论】:
-
你能发布你的html和脚本吗
标签: javascript jquery web
当内容位于容器 div 中时,有什么方法可以找出某人滚动了多少位置:relative。当位置设置为绝对时,我似乎只能使用 JavaScript 或 JQuery 获得滚动位置,但这会破坏站点布局。有什么解决办法吗?
【问题讨论】:
标签: javascript jquery web
fiddle 似乎没有问题:http://jsfiddle.net/dQ69u/
#container{
position:relative;
overflow-y:scroll;
width:400px;
height:400px;
background-color:#CCC;
}
#scrollable{
position:relative;
width:80%;
margin-left:10%;
height:1000px;
background-color:#000;
}
甚至在这个:http://jsfiddle.net/dQ69u/1/
#container{
position:relative;
overflow:hidden;
width:400px;
height:400px;
background-color:#CCC;
}
#scrollable{
position:relative;
width:80%;
margin-left:10%;
height:1000px;
background-color:#000;
}
#scrollBox{
position:relative;
overflow-y:scroll;
width:80%;
margin-left:10%;
height:400px;
}
【讨论】: