简体   繁体   English

我对焦点、z-index 及其与滚动的关系有疑问

[英]I have a question about focus, z-index, and their relation to scrolling

Visit here for an example: www.davepoyzer.com访问此处查看示例:www.davepoyzer.com

My problem is, the top div (#topheader) sits above (via z-index) the scrolling div (#content).我的问题是,顶部 div(#topheader)位于(通过 z-index)滚动 div(#content)的上方。 If you try scrolling with your mouse while the cursor is over #topheader, it wont scroll #content, which is below it.如果您在 cursor 位于 #topheader 上方时尝试使用鼠标滚动,它不会滚动位于其下方的 #content。 Is their anyway to fix this with javascript (the page already entirely relies on javascript)?他们无论如何都要用 javascript 来解决这个问题(该页面已经完全依赖于 javascript)? I was thinking changing focus might do it, but I'm not very knowledgeable on focus.我在想改变焦点可能会做到这一点,但我对焦点不是很了解。

Here's an idea, but I don't know if it's possible.这是一个想法,但我不知道这是否可能。 Basically, when mouse is scrolled over one div (#topheader), it would be capture with javascript and scroll a different div (#content).基本上,当鼠标滚动到一个 div (#topheader) 上时,它将被 javascript 捕获并滚动另一个 div (#content)。 Is this possible?这可能吗?

The current CSS is as is because of several different factors.当前的 CSS 是因为几个不同的因素。 I really don't think changing the CSS is going to work.我真的不认为改变 CSS 会起作用。 For example, you can't click on the nav links if you put #topheader under #content.例如,如果将#topheader 放在#content 下,则无法单击导航链接。

Any ideas or suggestions would be awesome!任何想法或建议都会很棒! Thanks for reading!谢谢阅读!

I guess you could bind code to the scroll event of the header and the code will scroll the content div.我想您可以将代码绑定到 header 的滚动事件,代码将滚动内容 div。 Here is a jQuery reference.这是 jQuery 参考。 http://api.jquery.com/scroll/ http://api.jquery.com/scroll/

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM