I want a div to be vertically fixed at a defined scrolllevel. I tried this:
HTML:
<div id='something'>Something! </div>
CSS:
#something {
position:relative;
}
JQuery:
$(window).scroll(function(){
if ($window.scrollTop() > 50){
$("#something").css({"top": ($(window).scrollTop()) -50 + "px"});
}
});
Here is a demo: http://jsfiddle.net/1Blerk/3jacz/4/ (#something should do the same as #headerMenu, but after some scrolling)
And i do not want to change position to be fixed!
I am not really familiar with JQuery, so i guess it is just some parantheses or a selector or...
Thanks in advance!