将 2 个浮动 div 粘在一起几乎可以与 jQuery 一起使用 - 需要抛光方面的帮助
过去几天我一直在研究这个问题,但无法让它完美顺利地工作。
概念:在多 div 页面上,向下滚动时导航应粘在窗口顶部,在搜索上滚动时应将搜索粘在导航下方。
需要解决的问题(只有 2 个主要问题):
- 滚动回窗口/文档顶部后,导航不会丢失浮动类。
搜索粘在导航 div 下方后,继续滚动会使搜索随机出现和消失(也许),它应该始终可见(这是一个 parseFloat 问题吗? ?)
可选 -和其他人一样,我想要一个可以添加到搜索中的动画 当坚持导航时
可选 - 将位置从绝对位置更改为固定位置后,使搜索保持其 offset.left,即使窗口/文档调整大小
这是我的整个代码的克隆:
感谢任何建议。
丹尼
I've been working on this for the last few days and cannot get it to work perfect smooth.
The concept: on a multi-div page, the navigation should stick to the top of the window when scrolling down and when scrolling over the search, stick the search below the navigation.
Issues need to be fixed (just 2 main issues):
- After scrolling back to top of the window/document, the navigation does not lose the floating class.
After the search gets stick below navigation div, continuing scrolling makes the search appear and disappear randomly (maybe), it should be always visible (is this a parseFloat matter?)
OPTIONAL - like anyone out there, I would like an animation that could be added to search
when sticking to the navigationOPTIONAL - make the search keep it's offset.left after changing the position from absolute to fixed even if the window/document gets resized
Here is a clone of my entire code:
Appreciate any suggestion.
Danny
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
几乎像魅力一样工作。
http://jsfiddle.net/W2FR4/37/
选项需要修复。
Almost working like a charm.
http://jsfiddle.net/W2FR4/37/
Optionals need to be fixed.
我认为它解决了你的一些问题。看看那里。
K
it addresses some of your problems I think. Have a look there.
K
谢谢科维奇。我已经知道了。非常感谢:)
http://jsfiddle.net/W2FR4/37/
在我的设置中,我还可以使其保持正确的定位。
我只是无法让它有一些很酷的动画,但我可以稍后再做。
再次致以问候和感谢,
丹尼
Thanks kwicher. I already figured out that. Thanks a lot :)
http://jsfiddle.net/W2FR4/37/
In my setup here I can also make it keep the right positioning.
I just cannot get it to have some cool animation, but I can leave that for later.
Regards and thanks again,
Danny