Css. How to move div with fixed position up if it overlays footer -


i have menu, content , footer. menu has fixed position. if scroll down end of page becomes overlay footer. how can force menu move if starts overlay footer?

enter image description here

edit: use bootstrap classes. html

<div class="container">     <div class="row">         <div class="col-sm-3" id="myscrollspy">             <ul class="nav nav-pills nav-stacked">                  <li class="active"><a href="#section1">section 1</a></li>                  <li><a href="#section2">section 2</a></li>                  <li><a href="#section3">section 3</a></li>                  ...             </ul>         </div>         <div class="col-sm-9">             <div id="section1">                     <h1>section 1</h1>                 <p>try scroll section , @ navigation list while scrolling!</p>             </div>             <div id="section2">                  <h1>section 2</h1>                 <p>try scroll section , @ navigation list while scrolling!</p>             </div>             ...     </div> </div> 

css:

ul.nav-pills {       position:fixed; } 

you should use bootstrap "affix" plugin.

http://getbootstrap.com/javascript/#affix

you can see example here of how works in combination scrollspy. http://codepen.io/sitepoint/full/ggozwx/ (not code)

essentially tell when start , stop being 'fixed' element.

$('#nav').affix({     offset: {            top: $('#nav').offset().top,       bottom: ($('footer').outerheight(true) + $('.application').outerheight(true)) + 40     } }); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -