I have a problem with positioning a Hello Bar. In the CSS, it’s relative which pushed the site down. To fix this, I use this javascript function:
<script language="javascript">
$(window).scroll(function(){
var $this = $(this);
$("#hello_bar").css("position", "fixed");
$('#hello_bar').css('position', "absolute" - $this.scrollTop());
});
</script>
If I scroll down the page and get back up to site top than the content is behind the Bar.. How can I fix this?
Set the
padding-topon the next element (theptag) to have apadding-topequivalent to theheightandpadding-top/padding-bottomof the#hello_bardiv. This number in your case is 60px. Also, take note that you should really perform this function only once, since it will be a waste of CPU resources after it has already been performed once.