当前位置:网站首页>js 监听和移除监听事件
js 监听和移除监听事件
2022-06-21 20:37:00 【samscat】
先上代码
const bfscrolltop = document.body.scrollTop;
document.getElementById('consultDes').addEventListener('focus', this.resetScoll, false)
document.getElementById('consultDes').addEventListener('blur', function() {
document.body.scrollTop = bfscrolltop
document.getElementById('consultDes').removeEventListener('focus', this.resetScoll, false)
clearInterval(timer);
}, false)
}
说明:
removeEventListener只能移除具名函数的监听,且方法名称后面不能带()
// 监听手机返回
window.addEventListener("popstate", goBack(), false);
function goBack () {
if (this.showSelectlist) {
this.showSelectlist = false
window.history.pushState("","","#");
window.location.href = window.location.origin + '/#/taskAdd'
}
console.log(window.location.href)
}
// 取消监听
window.removeEventListener("popstate", this.goBack, false);
边栏推荐
- 从-1开始实现一个中间件
- class path resource [classpath*:mapper/*.xml] cannot be opened because it does not exist
- Luogu p5440 [XR-2] miracle solution
- 利用while循环,分别计算1-100中奇数的和、偶数的和【方法二】
- 北京 加速生态建设 迈动互联与摩尔线程完成产品兼容互认证
- 秒懂微服务
- Utilisation de la combinaison d'assertions de l'API Stream et de la mise en cache locale pour les requêtes floues (près de 1000 fois plus efficace que MySQL)
- 迅为iTOP-3568开发板安装 RKNN Toolkit Lite2
- 【深入理解TcaplusDB技术】单据受理之事务执行
- [in depth understanding of tcapulusdb technology] tcapulusdb business data backup
猜你喜欢

Paml| Shengxin software for calculating dn/ds value

dotter|打点法进行序列两两比较软件

【深入理解TcaplusDB技术】 Tmonitor模块架构
![class path resource [classpath*:mapper/*.xml] cannot be opened because it does not exist](/img/1a/294eb0128285686ede415991f69be7.png)
class path resource [classpath*:mapper/*.xml] cannot be opened because it does not exist

TRNA analysis using trnascan se
![[deeply understand tcapulusdb technology] one click installation of tmonitor background](/img/33/7d390732d6e441a4311189b6e49474.png)
[deeply understand tcapulusdb technology] one click installation of tmonitor background

实验二 栈和队列

Using streamapi assertion combination and local cache for fuzzy query (nearly 1000 times more efficient than MySQL)

IP-guard打印管控,防止打印渠道信息泄露

2022 Foshan Tanzhou ceramics exhibition held a press conference to launch ten key points of the exhibition
随机推荐
Common abbreviations and terms of mitochondrial genome
window安装scoop的国内镜像
Introduction to class library, framework, module, component and other concepts
Use the while loop to calculate the odd and even sums in 1-100 [method 1]
Notes on question brushing (17) -- binary search tree: about attribute problems
Characteristics and experimental suggestions of abbkine cell cycle Staining Kit
How to uninstall a package installed with the CONDA command
Hiclotter|hic data visualization tool
Worthington deoxyribonuclease I solution
TRNA analysis using trnascan se
Using streamapi assertion combination and local cache for fuzzy query (nearly 1000 times more efficient than MySQL)
棋牌类游戏
An example of CPU instruction rearrangement leading to errors
类库、框架、模块、组件等概念介绍
Leetcode question brushing: SF Technology Smart logistics Campus Technology Challenge
Shell脚本简单语法
GDB debugging practice (8) transfer startup parameters to the program
[deeply understand tcapulusdb technology] transaction execution of document acceptance
Chess and card games
Use the do while loop to calculate the odd and even sums in 1-100 [method 2]