Home >Web Front-end >JS Tutorial >xScrollStick JS special effect that floats with the scroll bar_Layout and layers

xScrollStick JS special effect that floats with the scroll bar_Layout and layers

WBOY
WBOYOriginal
2016-05-16 17:54:161131browse

This is a JS special effect that floats following the scroll bar, which means that the scroll bar scrolls while the element’s position relative to the screen remains unchanged

There are many similar effects on the Internet. This code has the following advantages in comparison:

1. Compatible with IE6.0 & FF1.5
2. It is very simple to use and is the favorite for beginners. See the instructions below
3. There will be no conflicts between elements. Conflict, there can be n special effects on one page, and there is no code redundancy when using multiple elements

The disadvantages are:

1. Can only be used in documents declared as xHTML
2. It is best to place elements under the body
3. There will inevitably be flickering when scrolling (it is already relatively slight, but those who pursue perfection may find it uncomfortable)

Instructions for use:
Quote JS in the page package, and then set the class to xScrollStick on the div that needs special effects. Of course, don’t forget to write the position you want it to be fixed for each element

Example 1:

Copy code The code is as follows:


Content...


Example 2:
Copy code The code is as follows:


Content...


Demo:

Run Code Box

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