css3 - Is it possible to create a sticky vertical column using Bootstrap without having to specify position? -


i'm trying effect of sticky column right of text, in bootstrap web page.

here's code:

             <nav class="col-sm-4 col-md-4"  data-spy="affix"  data-offset-top="205">                 <div class="panel panel-default" >                     <div class="panel-heading"><h1>table des matières</h1></div>                     <section class="panel-body">                     <p>                         nullam luctus nisi est, id blandit nunc tristique vel!                      </p>                     </section>                 </div>             </nav> 

(there bar on left takes 8 previous columns)

this sort of works: sidebar appears in right place when page loads, , when scroll stays stuck top, but jumps across left , sits on top of left-most column, acquiring width doesn't seem have (5 columns , bit wide).

looking @ documentation seems have configure .affix class myself in css stays in right place (which seems bit strange, want stay in column comes from!). values should use? have tried putting in css:

.affix { top: 20px; left: 62%; width: 25%; } 

and works (the left positioning , width off), of course doesn't work when @ in different width browser window. mean have put appropriate media-queries? or use bit of calculation on basis of column widths etc? have basic sass knowledge - perhaps way forward, calculate these widths compiling bootstrap in sass?

also, if has idea how reveal chapter you're on in sidebar (exactly on bootstrap page) great!

looks need add right: 0; affix property in css keep pinned right. went ahead , created codepen of working model can check out below.

for design changes links based on position need add scrollspy class ul parent , style a links accordingly.

note added classes div , ul containing li nav elements.

for responsive design need set appropriate col widths xs, sm, , md.

bootstrap affix right-side


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -