Reputation: 43
I'm trying to build fixed html toolbar for my sites network. i'm using css's position:fixed and top:0 and push all elements using body:margin-top.
problem is when a specific site already have a fixed to top element.
is there a way (using css or js) to push down all elements including the fixed ones by a given value of pixels, considering that i don't know if there is one or what is its id/class/top value.
for example, if one site is using HelloBar (www.hellobar.com), i need my bar to push it and all the page content down instead of float over it.
Hope my question is clear enough.
Thanks in advance.
Upvotes: 3
Views: 1781
Reputation: 859
You need to get the height of the toolbar with jquery. Then give the container which is holding the content a margin-top = height of the toolbar.
var toolbar_height = $('.toolbar').height();
$('.container').css({'margin-top':toolbar_height});
Upvotes: 1