bootstrap fluid affix
来源:互联网 发布:淘宝上的古董店 编辑:程序博客网 时间:2024/06/16 13:21
Bootstrap的主页上的左边菜单是可以固定的。当页面宽度缩小,也能够滚动。
然而例子里的fluid布局里菜单不是固定的
如果简单的加上affix会发现菜单固定了,但是页面宽度缩小时不能滚动了。
看bt会有个额外的css处理这个问题。原理上说就是用了@media。在页面宽度小时取消了position:fixed属性。
http://stackoverflow.com/questions/9350818/fixed-sidebar-navigation-in-fluid-twitter-bootstrap-2-0
CSS
.sidebar-nav-fixed { position:fixed; top:60px; width:21.97%; } @media (max-width: 767px) { .sidebar-nav-fixed { width:auto; } } @media (max-width: 979px) { .sidebar-nav-fixed { position:static; width: auto; } }
HTML
<div class="container-fluid"><div class="row-fluid"> <div class="span3"> <div class="well sidebar-nav sidebar-nav-fixed"> ... </div><!--/.well --> </div><!--/span--> <div class="span9"> ... </div><!--/span--></div><!--/row--></div><!--/.fluid-container-->
Demo, edit here.
minor note: there is about a 10px/1% difference on the width of the fixed sidebar, its due to the fact that since it doesn't inherit the width from the span3 container div because it is fixed i had to come up with a width. It's close enough.
And here is another method if you want to keep the sidebar fixed until the grid drops for small screen/mobile view.
CSS
.sidebar-nav-fixed { position:fixed; top:60px; width:21.97%;}@media (max-width: 767px) { .sidebar-nav-fixed { position:static; width:auto; }}@media (max-width: 979px) { .sidebar-nav-fixed { top:70px; }}
Demo, edit here.
- bootstrap fluid affix
- bootstrap affix附加导航
- bootstrap之affix
- Bootstrap---Fluid layout 流布局
- Bootstrap---Fluid layout 流布局
- Bootstrap---Fluid layout 流布局
- Bootstrap---Fluid layout 流布局
- Bootstrap 附加导航(Affix)插件
- Bootstrap 附加导航(Affix)插件
- Bootstrap : container 和container-fluid区别
- Bootstrap之container与container-fluid
- Bootstrap JS插件使用实例(10)-附加导航(affix)
- Bootstrap的js插件之侧边栏停靠(affix)
- bootstrap源码学习之附加导航affix(二)
- Bootstrap基础25——附加导航affix
- bootstrap中container类和container-fluid类的区别
- bootstrap中contain和contain-fluid的区别
- bootstrap中container类和container-fluid类的区别
- 将程序关联成Android系统默认打开程序
- 单片机程序设计基础(修订版)
- 字符串面试题
- Floyd算法
- FileZilla FTP服务器源代码分析09
- bootstrap fluid affix
- 脚本查看linux 密码更改日期和账户失效日期
- Java随机生成字母
- 查找排序数组的插入位置
- FileZilla FTP服务器源代码分析10
- linux下查看mysql版本
- 正态分布的前世今生(五)
- 剑指offer面试题4 替换一个字符串中的空格为 O(n)算法 和把两个有序数组合起来 依旧有序的算法
- C# WinForm控件随窗体大小改变自动适应改变