css - Adding things above and below bootstrap fixed navbar -


i trying add banner above fixed-top navbar. have looked around , understand basic concepts on how example little more complex , getting little lost.

user can add custom banner top of page. if happens need push (including fixed navbar) down height of banner (say 20 px).

i have created class can apply nav element:

.top-banner-nav {   top: 20px; } 

navbar:

  <nav class="navbar navbar-default navbar-fixed-top" ng-class="{'top-banner-nav': banner == true}"> 

that works great push static navbar down 20px if there banner. have problems.

  1. when have static navbar have add top padding body push body content below banner. of sudden need push body content down 70px. not sure if there way make happen dynamically.

  2. i have static navbar directly underneath top navbar. when move top navbar down 20px need move other navbar down 20px well. unfortunately lower nav fixed top: 50px place right below upper navbar.

i have plunker here demonstrates problem. , not sure go here. might have mess things in javascript, try , avoid @ possible avoid things jumping around on page load.

http://plnkr.co/edit/dyymz1?p=preview

i looked @ plunker. made changes css , html accomplish looking for. change made html body tag. new tag looks this:

<body ng-controller="maincontroller" ng-class="{'bodymodified': banner == true}"> 

the new css file looks this:

body {   padding-top: 50px; need move down body under fixed header }  .bodymodified {   padding-top: 20px; }  .settings-nav {     position: relative;     right: 0;     left: 0;     background-color: #e2e2e2;     z-index: 1029;     top:0px; }  .settings-content {     padding-top: 70px; }  .top-banner-nav {     position: relative;     margin: 0;     height: 20px; }  .top-banner {     position: fixed;     right: 0;     left: 0;     top:0;     margin-bottom: 0px;     background-color: #ffff00; } 

you can use javascript , jquery accomplish well. hope helps. let me know how goes.

here plunker demonstrating changes

http://plnkr.co/edit/39lhqa2gdmremntogxe4?p=preview


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -