移动端唤起键盘后焦点错位的情况
作者:互联网
// 解决唤起键盘后焦点定位错位的情况 使用方式@blur='blurhandler' blurhandler(){ let ua = window.navigator.userAgent; if(!!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)){ // ios 端 var currentPosition,timer; var speed=1; timer=setInterval(function(){ currentPosition=document.documentElement.scrollTop || document.body.scrollTop; currentPosition-=speed; window.scrollTo(0,currentPosition);//页面向上滚动 // currentPosition+=speed; // window.scrollTo(0,currentPosition);//页面向下滚动 clearInterval(timer); },100); } },
标签:错位,scrollTo,timer,键盘,currentPosition,window,blurhandler,唤起,speed 来源: https://www.cnblogs.com/TheHeartWants/p/11514639.html