当前位置:网站首页>smoothscroll-polyfill插件的用法
smoothscroll-polyfill插件的用法
2022-07-26 19:29:00 【YingUser】
使用这个插件可以实现滑动的效果,具体步骤如下:
1、npm 下载
npm install smoothscroll-polyfill --save2、在main.js中全局引入
import smoothscroll from "smoothscroll-polyfill"
smoothscroll.polyfill();3、在当前页面使用就引入
import smoothscroll from 'smoothscroll-polyfill';
具体主代码如下:
//注释:这里的 order-lock 是需要跳到的那个标签的类名
this.timer = setTimeout(() => {
smoothscroll.polyfill();
document
.getElementsByClassName('order-lock')[0]
.scrollIntoView({ block: 'start', inline: 'center', behavior: 'smooth' });
}, 3000);边栏推荐
- 答应我,看完别再写狗屎代码了。。
- 数组操作增,删,改,查
- 【Pytorch基础】torch.stack()函数解析
- There is an Oolong incident in open source. Maybe you don't know these five open source protocols
- Jincang database kingbasees SQL language reference manual (21. Kes regular expression support)
- Jincang database kingbasees SQL language reference manual (18. SQL statement: drop materialized view to drop synonym)
- 有点酷,使用 .NET MAUI 探索太空
- Use request header authentication to test API interfaces that need authorization
- 数据库笔记(来自老社)
- 一文读懂 .NET 中的高性能队列 Channel
猜你喜欢

Fasttunnel open source intranet penetration framework

20220725 tree array introspection

【OBS】解决OBS推两个rtmp流 + 带时间戳问题

Silent desktop fan chip dltap703sd Jericho

SwiftUI 4 新功能之实时获取点击位置 .onTapGesture { location in} (教程含源码)
[cache series] advantages, disadvantages and choices of several cache read-write schemes

解决AttributeError: module ‘win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9‘ has no attribu

网红辣条抓不住年轻人

UE5编辑器Slate快速入门【开篇】

plsql包
随机推荐
C# 客户端程序调用外部程序的3种实现方法
cv2.resize()
【机器学习】变量间的相关性分析
numpy.zeros_like
How to wait for the return results of multiple asynchronous tasks synchronously?
Shell script basic programming commands
Use request header authentication to test API interfaces that need authorization
解决AttributeError: module ‘win32com.gen_py.00020813-0000-0000-C000-000000000046x0x1x9‘ has no attribu
EtherCAT 同步模式
How to build a super interface collaboration platform: count the six weapons of apifox
go+mysql+redis+vue3简单聊室,第5弹:使用消息队列和定时任务同步消息到mysql
猿辅导的科技硬实力:让AI从读懂孩子作业开始
URL format
正则表达式
Cookie和Session
There is an Oolong incident in open source. Maybe you don't know these five open source protocols
An open source web drawing board is really convenient
开源闹出乌龙事件,可能你不知道这五种开源协议
.NET GC工作流程
numpy.zeros_ like