Better-scroll scrolling principle
<div class="wrapper"> <ul class="content"> <li>...</li> <li>...</li> ... </ul> <!-- You can put some other DOM here, but it will not affect the scrolling--> </div> So we will only talk about the most important point here! ! !
This is the biggest reason why all users are unable to scroll. I encountered this problem a few days ago, and the better-scroll document was inaccessible. The document on github was only roughly usable. I spent a whole day looking for a solution. Various methods emerged on the Internet. The best solution: Through plugin: better-scroll/observe-dom BetterScroll dynamically calculates the scrollable height or width. You don't need to manually call the refresh() method when the height or width changes. The plugin does this for you via MutationObserver . If your current browser does not support MutationObserver, it will be downgraded to use setTimeout. use
import BScroll from '@better-scroll/core' import ObserveDom from '@better-scroll/observe-dom' BScroll.use(ObserveDom) const bs = new BScroll('.wrapper', { observeDOM: true }) There are many solutions to this problem, but many articles on the Internet do not explain it clearly. Just use this plug-in. Another solution is to listen to the image loading and call refresh() to recalculate the height
This concludes this article about the better-scroll plug-in's inability to slide (solved in 2021 through plug-ins). For more related content about the better-scroll plug-in's inability to slide, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Solution to the error when importing MySQL big data in Navicat
>>: How to set up jar application startup on CentOS7
1. Best left prefix principle - If multiple colum...
Table of contents 1. Introduction 2. Solution Imp...
Table of contents Overview Why choose a framework...
Preface MySQL version 8.0.23 adds a new feature: ...
Table of contents Writing Background Project Desc...
1. Grammar: <meta name="name" content...
First, let’s take an example: There is a type fie...
Recently, new projects have used springcloud and ...
To achieve the background color flashing effect, j...
1. Introduction to Docker Docker is developed in ...
Table of contents 1. Simple page example 2.uni-ap...
1. Introduction A few days ago, a development col...
Table of contents 1 Introduction 2 Trigger Introd...
This article example shares the specific code of ...
This is an official screenshot. After MySQL 5.7 i...