简体   繁体   English

导航栏固定在底部位置,并在到达滚动位置时切换到静态

[英]Navbar fixed bottom position and switch to static when scroll location reached

Is this possible in Bootstrap v3? Bootstrap v3有可能吗? I've been searching and seems like I'll have to go custom. 我一直在搜索,似乎必须自定义。

Basically, I have a navbar which is located at the bottom of the content area. 基本上,我有一个导航栏,位于内容区域的底部。 When the page is loaded, if the navbar code location is visible in the viewport then position should be static but if the page is longer and the code location is not visible then the position should be fixed bottom. 加载页面时,如果导航栏代码位置在视口中可见,则该位置应为静态,但如果页面较长且代码位置不可见,则该位置应固定在底部。

It's like the top navbars but for the bottom. 就像顶部的导航栏,但底部的。

Sure, it's possible 当然可以

1 Load bootstrap.js, bootstrap.css and jquery.js 1加载bootstrap.js,bootstrap.css和jquery.js

2 Place the navbar at the end of the page 2将导航栏放在页面的末尾

<div class=navbar data-spy="affix" data-offset-top="1">navbar</div>

3 Add a class into your page 3在您的页面中添加一个类

.affix{bottom:0;}

That's it. 而已。

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

相关问题 当到达英雄区域的底部时,将静态导航栏更改为滚动固定 - change static navbar to fixed on scroll when bottom of hero section is reached 到达特定部分的底部时如何将位置静态更改为固定 - How to change the position static to fixed when the bottom of specific section is reached 当您在滚动上到达其原始位置时,将位置从固定到最底部切换到div的初始位置 - Switch position from fixed to the very bottom to initial of a div when you reach its original position on scroll 滚动位置在底部时更改为固定位置 - Changing to fixed positioning when scroll position is at bottom 到达底部页脚时如何停止粘边栏的固定位置 - How to stop fixed position of sticky sidebar when bottom footer is reached 导航到顶部时导航栏位置保持固定 - Navbar Position remain fixed when scroll back to top 导航栏将位置更改为固定时,导航栏使内容跳转 - Navbar makes content jump when position is changed to fixed on scroll past 带有动画滚动时,bootstrap 3导航栏的静态顶部更改为固定顶部 - bootstrap 3 navbar static top change to fixed top when scroll with animation 当 position 从固定切换到 static 时,不会出现反向粘性导航栏? - Reverse sticky navbar not appearing when position switches from fixed to static? 位置:固定到位置:静态,当水平滚动出现时? - Position: fixed to position:static when horizontal scroll shows up?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM