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

Example of scrollLeft() method usage in jQuery_jquery

WBOY
Release: 2016-05-16 16:19:55
Original
1048 people have browsed it

The example in this article describes the usage of the scrollLeft() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This method gets or sets the offset of the matching element relative to the left side of the scroll bar.

Grammar structure 1:

When the scrollLeft() method has no parameters, it gets the offset of the matching element relative to the left side of the scroll bar.

Copy code The code is as follows:
$(selector).scrollLeft()

Example code:

Copy code The code is as follows:






Script Home













Grammar structure 2:

When scrollLeft() takes parameters, it sets the offset of the matching element relative to the left side of the scroll bar.

Copy code The code is as follows:
$(selector).scrollLeft(val)

Parameter list:

参数 描述
val 设置水平滚动条左侧偏移量

Example code:

Copy code The code is as follows:






Script Home













I hope this article will be helpful to everyone’s jquery programming design.

This article is reproduced from: Ant Tribe http://www.softwhy.com/

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!