How to use the mobile plug-in IScroll.js
We know that the IScroll.js plug-in is compatible with all mobile scroll bar events. In some Android machines, we cannot operate the scroll bar through overflo:scroll; but IScroll.js can indeed be placed in a safe container element. To handle scrolling, I will give you a detailed introduction to IScroll.js.
Note
When using IScroll.js, you must have three levels of element nesting, such as:
<div class="food-left"> <ul class="food-nav"> <li></li> <li></li> <li></li> <li></li> </ul></div>
The outermost food-left must have two css styles : position:relative; and overflow:hidden.
Initialization
IScroll.js exposes us an IScroll constructor;
As follows, we initialize
<script type="text/javascript"> leftScroll = new IScroll(".food-left");</script>
In the constructor The actual parameters passed in are consistent with the new querySelector parameter in ES6; in fact, querySelector is used in the same way as our jQuery selector;
Note: We must initialize it after the DOM structure is loaded, otherwise it will be invalid.
Settings
IScroll.js allows us to pass in the second parameter to configure the properties of the scroll event;
leftScroll = new IScroll(".food-left", { scrollbars: true, bounce: false, mouseWheel:true, click:true});
Scroll bar
scrollbars: true
Whether to display scrolling strip. The default is false;
fadeScrollbars:true
The scroll bar fades in and out, of course provided that your scroll bar is displayed. The default is false;
interactiveScrollbars
Whether to drag the scroll bar. The default is false;
resizeScrollbars
The length of the scroll bar is set proportionally. If you want a fixed size, you can set it to flase;The default is true;
bounce: false
Scroll Whether to perform a bounce animation when reaching the container boundary. The default is true;
mouseWheel:true
Whether to display enabled mouse scrolling; the default is false;
invertWheelDirection
Whether to enable reverse scrolling after activating mouse scrolling; the default is false;
click:true
iScroll prohibits the default mouse click behavior. If you want to use the setting true; the default is false;
disableMouse、disablePointer、options.disableTouch
IScrol listens to all pointer events by default. If you confirm the platform where the project is positioned , you can disable unused effects to reduce resource usage; the default is false;
startX、startY
Set the initial offset position of the scroll bar; the default is none;
Method
IScroll.js also provides us with some convenient methods, of course they are all under the instance object;
rightScroll.scrollToElement(el, time, offsetX, offsetY, easing)
Scroll to the position of the incoming element, which must be a native DOM object;Then comes the scrolling time;
scrollTo(x, y, time, easing)
You can scroll to any position, the default position is 0, if you want to move, you need to set a negative number;
I believe after reading these You have mastered the case method. For more exciting information, please pay attention to other related articles on the PHP Chinese website!
Related reading:
Detailed explanation of the path module of node.js
The above is the detailed content of How to use the mobile plug-in IScroll.js. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PyCharm is a powerful and popular Python integrated development environment (IDE) that provides a wealth of functions and tools so that developers can write code more efficiently. The plug-in mechanism of PyCharm is a powerful tool for extending its functions. By installing different plug-ins, various functions and customized features can be added to PyCharm. Therefore, it is crucial for newbies to PyCharm to understand and be proficient in installing plug-ins. This article will give you a detailed introduction to the complete installation of PyCharm plug-in.
![Error loading plugin in Illustrator [Fixed]](https://img.php.cn/upload/article/000/465/014/170831522770626.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
When launching Adobe Illustrator, does a message about an error loading the plug-in pop up? Some Illustrator users have encountered this error when opening the application. The message is followed by a list of problematic plugins. This error message indicates that there is a problem with the installed plug-in, but it may also be caused by other reasons such as a damaged Visual C++ DLL file or a damaged preference file. If you encounter this error, we will guide you in this article to fix the problem, so continue reading below. Error loading plug-in in Illustrator If you receive an "Error loading plug-in" error message when trying to launch Adobe Illustrator, you can use the following: As an administrator

When users use the Edge browser, they may add some plug-ins to meet more of their needs. But when adding a plug-in, it shows that this plug-in is not supported. How to solve this problem? Today, the editor will share with you three solutions. Come and try it. Method 1: Try using another browser. Method 2: The Flash Player on the browser may be out of date or missing, causing the plug-in to be unsupported. You can download the latest version from the official website. Method 3: Press the "Ctrl+Shift+Delete" keys at the same time. Click "Clear Data" and reopen the browser.

What is the Chrome plug-in extension installation directory? Under normal circumstances, the default installation directory of Chrome plug-in extensions is as follows: 1. The default installation directory location of chrome plug-ins in windowsxp: C:\DocumentsandSettings\username\LocalSettings\ApplicationData\Google\Chrome\UserData\Default\Extensions2. chrome in windows7 The default installation directory location of the plug-in: C:\Users\username\AppData\Local\Google\Chrome\User

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

Does PyCharm Community Edition support enough plugins? Need specific code examples As the Python language becomes more and more widely used in the field of software development, PyCharm, as a professional Python integrated development environment (IDE), is favored by developers. PyCharm is divided into two versions: professional version and community version. The community version is provided for free, but its plug-in support is limited compared to the professional version. So the question is, does PyCharm Community Edition support enough plug-ins? This article will use specific code examples to

Detailed explanation of how to install and set up the EclipseSVN plug-in Eclipse is a widely used integrated development environment (IDE) that supports many different plug-ins to extend its functionality. One of them is the EclipseSVN plugin, which enables developers to interact with the Subversion version control system. This article will detail how to install and set up the EclipseSVN plug-in and provide specific code examples. Step 1: Install the EclipseSVN plug-in and open Eclipse

JavaScript and WebSocket: Building an efficient real-time weather forecast system Introduction: Today, the accuracy of weather forecasts is of great significance to daily life and decision-making. As technology develops, we can provide more accurate and reliable weather forecasts by obtaining weather data in real time. In this article, we will learn how to use JavaScript and WebSocket technology to build an efficient real-time weather forecast system. This article will demonstrate the implementation process through specific code examples. We
