Home > Web Front-end > JS Tutorial > body text

How to determine whether an element has scroll bars in jquery

coldplay.xixi
Release: 2021-01-25 15:34:09
Original
2852 people have browsed it

Judgment method: First use the "$("body").scrollTop(10)" statement to control the scroll bar scrolling, and then use "if( $("body").scrollTop()>0)" The statement determines whether the scroll bar is offset; if there is an offset, the scroll bar exists. On the contrary, it does not exist without scrolling.

How to determine whether an element has scroll bars in jquery

The operating environment of this tutorial: windows7 system, jquery3.2.1 version, Dell G3 computer.

How jquery determines whether an element has a scroll bar:

Use jQuery to control the scroll bar scrolling, and then determine whether the scroll bar is offset. If there is, the scroll bar exists, otherwise it does not exist without scrolling.

Copy after login

Related learning recommendations: javascript video tutorial

The above is the detailed content of How to determine whether an element has scroll bars in jquery. For more information, please follow other related articles on the PHP Chinese website!

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 [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!