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
For the beginner's first installation of MySQ...
Sometimes we may need to run some commands on a r...
When using vue to develop projects, the front end...
Environment Introduction Operating system: centos...
Table of contents background LIMIT Optimization O...
Composition API implements logic reuse steps: Ext...
Business scenario requirements and implementation...
B-Tree Index Different storage engines may also u...
MySQL software installation and database basics a...
Table of contents forEach() Method How to jump ou...
Let's take a look at my error code first. htm...
Copy code The code is as follows: <style type=...
This article example shares the specific code of ...
Table of contents 1. How to represent the current...
Ubuntu 16.04 builds FTP server Install ftp Instal...