javascript - Fixed divs under the bootstrap fixed nav -


i'd attach fixed alerts underneath navbar-fixed navigation bar in bootstrap. best attempt point make div positioned @ 50px position: fixed; , width: 100%, , insert alerts in div. problem cuts off top of other content same way navbar-fixed cuts off content when 1 fails apply padding body element.

#alerts {   position: fixed;   width: 100%;   top: 50px; } .alert {   top: 0px;   //position: fixed;   padding-left: 15px;   padding-right: 15px;   padding-top: 4px;   padding-bottom: 4px;   margin-bottom: 0px;   border-radius: 0px; } body {   padding-top: 50px; // avoid 'underlapping' navbar } 

here's link not-working example: http://www.bootply.com/pnehtlhubi

my best idea @ moment use js adjust padding-top value on body alerts created/destroyed, bad maintenance/readability , i'd prefer more declarative css.

any suggestions?

looks there won't way without js.

since if alert dynamic, meaning appears when triggers via alert method

$('#alert-danger').show('slow', function(){     $('body').addclass('moremargin') }); 

you can remove moremargin class body when hide alert


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -