I have a problem with jQuery, I want to change a DIV (not the content of the DIV but the DIV NAME div id=”DIVNAME”) when the scrollbar is at 20px.
Before scrollbar = 20px :
divname {
width: 1012px;
margin: 25px auto 0 auto;
height: 50px;
}
After scrollbar + 20px :
divname2 {
width: 1012px;
margin: 25px auto 0 auto;
height: 50px;
position: fixed;
}
My specific case :
image http://i.minus.com/jjjWR2hKWhhFw.jpg
Thanks for the help.
You can do this way, like adding a class to the parent
divto make it fixed. Will post the code and fiddle shortly.Yup done with the code:
JavaScript
CSS
HTML
Fiddle
Watch it live at http://jsfiddle.net/ekeSL/
Changing the name of the
divIt is not advisable to change the
idof thediv. But still if you insist on it, you can do so by this way: