css position - Overflow of sidebar with Twitter Bootstrap Affix -
i'm trying use affix plugin twitter bootstrap can't figure out how constrain within parent container, i've created following example show problem:
problem demo: http://www.codeply.com/go/dvcrxkefza
<div class="container"> <div class="row"> <div class="col-md-3 column"> <ul id="sidebar" class="well nav nav-stacked" data-spy="affix" data-offset-top="130"> <li><a href="#software"><b>software</b></a></li> <li><a href="#features">features</a></li> <li><a href="#benefits">benefits</a></li> <li><a href="#costs">costs</a></li> </ul> </div> <div class="col-md-9 column"> <h1>blah, blah, blah</h1> <hr> <a class="anchor3" id="top" name="software"></a> <p> content here scrolls... </p> </div> </div> </div> as can see when scroll overflows out of sidebar, doesn't affix bottom of page when reaches bottom.
from bootstrap docs (http://getbootstrap.com/2.3.2/javascript.html#affix)..
heads up! must manage position of pinned element , behavior of immediate parent. position controlled affix, affix-top, , affix-bottom. remember check potentially collapsed parent when affix kicks in it's removing content normal flow of page.
so need css affix set width element when becomes fixed. such as:
#sidebar.affix { position: fixed; top: 0; width:225px; } demo on bootply: http://bootply.com/73864
related answers on bootstrap affix:
how create sticky left sidebar menu using bootstrap 3?
twitter-bootstrap 3 affixed sidebar overlapping content when window resized , footer
Comments
Post a Comment