1

I want to position a element next to (and follow) the middle of the scrollbar. In other words, glue a element to the middle of the scrollbar. I guess you have to dynamically get the height and position of the scrollbar and update the elements properties with setInterval for example.

Any ideas? Thanks in advance!

4

1 回答 1

3

因为<div id="thingy"></div>,你可以让东西粘在滚动条的中间,而不用担心与滚动条属性有任何关系。让事情看起来像:

#thingy {
     position:fixed;
     top:45%;
     bottom:45%;
     height:10%;
     right:0px;
}

这是假设您的元素的高度是屏幕高度的 10%,并且希望紧贴在页面左侧的滚动条上。

于 2012-07-09T13:18:43.577 回答