解决微信6.7.4以上 ios12软键盘顶起页面后隐藏不回弹解决方案

   if(navigator.userAgent.match(/MicroMessenger/i) == 'MicroMessenger'){
     setTimeout(() => {
      var input_box=document.getElementsByTagName('input');
      for (let i = 0; i < input_box.length; i++) {
        if(input_box[i].getAttribute('type')!='checkbox'){
          input_box[i].function () {
            var currentPosition,timer;
            var speed=1;//页面滚动距离
            timer=setInterval(function(){
                currentPosition=document.documentElement.scrollTop || document.body.scrollTop;
                currentPosition-=speed; 
                window.scrollTo(0,currentPosition);//页面向上滚动
                currentPosition+=speed; //speed变量
                window.scrollTo(0,currentPosition);//页面向下滚动
                clearInterval(timer);
            },1);
          }
        }
      }
    }, 100);
  }

你可能感兴趣的:(随手笔记)