Home >Web Front-end >HTML Tutorial >fixSidebar introduction and correction log_html/css_WEB-ITnose

fixSidebar introduction and correction log_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:49:081524browse

fixSidebar is a sidebar fixed widget written by myself. It is mainly used to keep the sidebar displayed when the main content is long. It relies on jQuery.

Github address https://github.com/iRuxu/iRuxu.ui/tree/master/fixSidebar

Example address http://www.jx3pve.com/macro

The reason for writing the whole thing is that I saw a course written by Yuanren in a MOOC and wanted to write it, but the functions were refined.

Usage

fixSidebar(selector,top,bottom,triggerScroll)

For example

fixSidebar('sidebar',30,80,100)

Parameter description

selector is the selector, which will be passed into jQuery. If not, the function will be exited, so if you are lazy, you can load it directly in the global JS file.

top is the incoming top position. The function of this is that if there is a fixed panel navigation or user bar, if no value is passed, it will be 0.

bottom is the incoming bottom position. This function is the bottom position. If you have global bottom navigation, etc., you should set this value, which can be slightly higher than the bottom bar height. If it is a little larger, it will retain the sense of spacing. If no value is passed, it will be 0.

triggerScroll was added in v0.3. At that time, because this page in your private project also had a header banner, you can also set it if necessary. The value when the fix is ​​triggered. For example, this page will start to trigger after 250.

Built-in automatic determination of the actual horizontal coordinates in the page by default. When the sidebar length is shorter than the page length, the position is calculated based on the top by default. When the sidebar length is greater than the page length, the position is calculated based on the bottom.

In the recent application of the copy column, due to the existence of slideshow scrolling, I found that there would be a slight scrolling abnormality. After thinking for a long time, I found that it was caused by the BFC management of the slideshow overflow. The final solution was to pass the slideshow The incoming selector is set to overflow:hidden and must be managed by itself. This item has been automatically added to the function in v0.4, and no additional css settings are required.

Okay, finally, if you have better suggestions, you can also give me feedback ~

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn