Jquery achieves fixed navigation top effects like mogujie.com and jquery mushrooms
Jquery achieves a fixed navigation top effect. It looks good like mogujie.com. If you need it, refer to it.
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
How does jquery fix the navigation bar on the top of the screen? No matter how the page is scrolled, you can always see the navigation bar
$ (Window). scroll (function () {// events triggered when the browser scroll bar is rolled
// Set your navigation bar relative to the top
});
How to Use jQuery to implement a fixed toolbar at the header or bottom, just like a toolbar at the bottom
If there is no special effect, use the css attribute position: fixed;
Of course, this attribute is not supported by ie6, so you need to write a css hack.
For example, div {
_ Position: absolute;
_ Bottom: auto;
_ Top: expression(eval(document.documentElement.scrollTop+document.doc umentElement. clientHeight-this.offsetHeight-(parseInt (this. currentStyle. marginTop, 10) | 0)-(parseInt (this. currentStyle. marginBottom, 10) | 0 )));
}
This is at the bottom of the webpage.
If you need a gap, you can use _ margin-bottom: 10px; to modify the value to control the position of the element.
Similarly, if the distance is from the top, it is _ top: expression(eval(document.doc umentElement. scrollTop); _ margin-top: 10px;, etc.