JQuery fixed element plugin scrolltofixed User Guide
JQuery fixed element plugin scrolltofixed User Guide
ScrollToFixed (jquery Fixed plugin) can fix the navigation or header of a webpage on the top or bottom, making it easier for users to operate or view information. In addition to navigation and header, you can also fix other content, such as advertisements and return to the top.
This plug-in was used once some time ago and was changed to a website. The top menu bar must be fixed with the scroll of the scroll bar. I also wrote about it, but I only mentioned it in the article. The article address: fixed element LOCATION OF THE jQuery plug-in. In this article, I will make a summary.
I. scrolltofixed plug-in Function
Fixed the position of an element. The element is still displayed during Page scrolling.
Ii. Official scrolltofixed address
Https://github.com/bigspotteddog/scrolltofixed. There are instructions for use on the official address, and the following describes the attributes of the plug-in. The demo also contains detailed use cases, which can be downloaded and viewed.
Iii. How to Use scrolltofixed
The scrolltofixed plug-in is still widely used. We can fix the top, the sidebar, or "fixed any element on the page ". Through the use of other plug-ins, you can get very good results. If the scroll bar is detected to a certain position, a certain element is displayed. In the test case, we use the scrolltofixed plug-in together with the scrollto plug-in. For the specific effect, see the "test file" below ".
1. reference file
The scrolltofixed plug-in is very simple to use. You only need to reference two JavaScript codes. One file is jquery and the other is the js file required by the scrolltofixed plug-in.
?
1 2 |
<Script type = "text/javascript" src = "jquery. min. js"> </script> <Script type = "text/javascript" src = "jquery-scrolltofixed.js"> </script> |
2.css Style File. You do not need a style file to use the plug-in, but you need to define elements with fixed positions. You need to customize the style for the elements. The style file is not pasted here. You can refer to the following "Test File ".
3. js code. Initialization can be implemented in one sentence, or initialization attributes can be set as needed. Such as the style of an element, the style displayed at a fixed time, and the fixed element is no longer fixed. See the official demo.
// The test in this article is just a fixed element and the default attribute is used.
$ ('# Operbox'). scrollToFixed ();
4. html used. Html is required for fixed-position elements. You can refer to the following "Test File ".
To improve the effectiveness of the test cases and use the scrollto plug-in, the scrollto plug-in is used to scroll to the specified element.
Test environment: ie8 browser, chrome, and firefox. Test results: