Home > Web Front-end > JS Tutorial > The code implemented by jquery to change the fixed layer into a positioning layer when the screen exceeds the screen_jquery

The code implemented by jquery to change the fixed layer into a positioning layer when the screen exceeds the screen_jquery

WBOY
Release: 2016-05-16 18:34:09
Original
1051 people have browsed it

A very good user experience example. If you don’t understand, just look at the picture below.

Taobao product list http://search1.taobao.com/browse/50010388/…
taobao浮动层实例

Tencent Finance Industrial Economy http://finance.qq.com/industry/index.htm
The code implemented by jquery to change the fixed layer into a positioning layer when the screen exceeds the screen_jquery
How to achieve it?
What is scrollTop? When the height of the content inside the element exceeds the height of the element itself, a scroll bar will appear. The height of the upper part that is hidden as the scroll bar is dragged is the scrollTop value.
This kind of positioning layer means that when the page triggers the onscroll event, the scrollTop value is obtained and written into the positioning layer CSS attribute to maintain the position.
The following is the example code

Copy the code The code is as follows:





定位层








Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template