3

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.

spartacus
  • 43
  • 5

1 Answers1

1

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});
Klevis Miho
  • 851
  • 8
  • 15
  • 1
    Thanks. it's working only if i know all the elements having a fixed position. is there an option with jQuery to select all those elements? – spartacus Dec 26 '12 at 16:17
  • 1
    OK. found it here [link](http://stackoverflow.com/questions/9255312/jquery-select-elements-with-a-certain-css). thank you :) – spartacus Dec 26 '12 at 16:22