ios手机弹出层上表单的操作,收起键盘焦点错乱的问题

今天遇到了ios手机下 弹出层上form表单 当收起键盘后,焦点错乱,无法再操作的问题

解决办法

function device() {
    const u = navigator.userAgent;
    const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
    const isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    if (isAndroid)
      return 'android';
    if (isiOS)
      return 'ios';
 }
if(device() === 'ios'){
	$("#half input").each(function(){
		$(this).blur(function(){
			window.scroll(0,0);
		})
	})
}

解决办法在每个input 上失去焦点后让页面重新回到顶部

参考了https://blog.csdn.net/qq_23179075/article/details/86497498

  

猜你喜欢

转载自www.cnblogs.com/junwu/p/10551821.html