修改滚动方向
基本上,我正在创建一个分为两栏的网站。这些列位于浏览器的中间高度,并分别占据屏幕的 50%。基本示例:
-------------
| | |
| up | down |
| | |
-------------
我设计了这个。每列都是一个 div,并且都垂直滚动。我想要的是能够滚动任一 div,并且右侧的滚动方向与左侧的滚动方向相反;但它们同时滚动。
我还希望右侧有一个滚动条(就像普通的垂直网站一样),但是当您滚动它时,一侧向上,另一侧向下。
有人可以在这里提供帮助吗?或者给我指出一个特定的方向?
So basically, I'm creating a site that thats split into two columns. These columns are go the entre height of the browser and individually fill up 50% of the screen. Basic example:
-------------
| | |
| up | down |
| | |
-------------
I've designed this. Each column is a div and both scroll vertically. What I want is to be able to scroll either div and the scroll direction on the right goes the opposite way to the one on the left; but they scroll at the same time.
I'd also like a single scrollbar on the right (like a normal vertical site) but when you scroll that, one side goes up and the other side goes down.
Is anyone able to assist here? Or point me into a particular direction?
Example:
http://buero-buero.org/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无耻地被你链接的页面盗走了,这很琐碎:
编辑:
回答你的评论:
A)
window.scrollY
是页面的垂直滚动量,你绝对使用反向绝对位置定位您的#down
div。如果你不明白它,你至少应该弄乱它一段时间来理解它,或者更好的是,学习window.scrollY
和 jquery$().style
工作。B)这不是你可以投入积分的代码量……这不是偷窃,而是简单地不是重新发明轮子。
C) 没明白重点,抱歉,
#down-right
就是您在问题中提出的问题:一个div
沿滚动条的相反方向滚动。再次编辑:
别忘了看看 css:
Shamelessly stolen by the page you link, it's quite trivial:
Edit:
Answering your comment:
A)
window.scrollY
is the amount of vertical scroll of the page, you just absolute position your#down
div with a reverse absolute position. If you don't understand it you should at least mess with it for a while to understand it or, better, learn howwindow.scrollY
and jquery$().style
work.B) It's not the amount of code you can put credits on... it's not stealing but simply not reinventing the wheel.
C) Don't get the point, sorry,
#down-right
is what you are asking in your question: adiv
scrolling in the opposite direction of the scrollbar.Edit again:
Don't forget to give a look at css too: