Bootstrap 3.0 : Fixed column

大兔子大兔子 提交于 2019-12-04 07:19:04

You will find the docs for the affix plugin here: http://getbootstrap.com/javascript/#affix wrap he elements you want to affix in a container div (b.e. with id="subnav").

Set the affix of this container by Javascript or Via data attributes.

javascript: $('#subnav').affix(); or via data attributes: <div id="subnav" data-spy="affix">

Cause you don't want you elements overlap your fixed navbar you will have to set top offset. The top offset should be at least the height of your navbar.

If your design got a footer you will also set the bottom offset. Cause you don't want the affixed element overlap the footer.

Javascript: $('#subnav').affix({offset:{top:150,bottom:150}}); or via data attributes: <div id="subnav" data-spy="affix" data-offset-top="150" data-offset-bottom="150">

Use CSS to affix the elements on the top of your documents: .affix{position:fixed;top:0px;}

More examples: https://github.com/twbs/bootstrap/pull/9902/files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!