1. Baidu Downloads sidebar-follow-jquery: Click to download
2. Place the downloaded file in the js folder of the topic to introduce the plug-in and add it before the tag (usually in the footer. Php file).
Run the following code:
The code is as follows: |
Copy code |
<Script src = "http://code.jquery.com/jquery-1.9.1.min.js"> </script> <Script src = "<? Php echo get_template_directory_uri (). '/js/sidebar-follow-jquery.js ';? > "> </Script> |
Note: If the jquery library has been introduced in your topic, you do not need to introduce it again here!
3. Add the following code after the code just added:
The code is as follows: |
Copy code |
<Script> (New SidebarFollow (). init ({ Element: jQuery ('# archives '), PrevElement: jQuery ('# recent-comments '), DistanceToTop: 10 }); </Script> |
Parameter description:
Element: replace the content in the brackets # archives with the tag id of the content to be fixed;
PrevElement: Enter the id of the last tag you want to fix in brackets, which is optional;
DistanceToTop: the distance between content and the top of the page when the page is scrolling.