gpt4 book ai didi

jquery - 制作粘性垂直导航的最佳方式是什么

转载 作者:行者123 更新时间:2023-11-28 09:54:03 24 4
gpt4 key购买 nike

我正准备对我的投资组合进行编码,我希望在这个网站上有这样的垂直导航:http://pixelhint.com/demo/magnetic/index.html

我看到其他人用 JQuery 做到了,但它是水平的。如果导航是垂直的,我找不到任何解决方案。

如果有任何帮助,我将不胜感激。我喜欢使用 jquery 插件的想法,但我认为如果我从头开始编写代码会更好。我只需要知道如何去做。

最佳答案

只有在这种情况下你才擅长CSS

您基本上需要做的是创建一个具有固定位置的元素。然后只需在您的主要内容元素上添加一些边距(填充/边距)

http://jsfiddle.net/PZRqY/

<aside>navigation content</aside>
<main>the main content</main>

aside {

position:fixed;
left:0;
top:0;
bottom:0;
width:300px;//a value by which you need to add a offset onto your content element
height:100%;

}

main {
padding-left:300px;//offset so as the content is not overlayed by the navigation
}

关于jquery - 制作粘性垂直导航的最佳方式是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24971221/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com