一屏式页面ios解决页面input导致页面内容错位问题

2021-04-16  本文已影响0人  Blendz
  !function () {
    if (document.querySelector("body").clientHeight > window.innerHeight) { return false }
    let t = null
    $("body").on('focus', 'input,textarea', function () { if (t) clearTimeout(t) });
    $("body").on('blur', 'input,textarea', function () {
      // 200ms 是为了解决多个input 切换的时候 不需要回推页面
      t = setTimeout(() => { document.body.scrollTop = document.documentElement.scrollTop = 0; }, 200)
    });
  }()
上一篇 下一篇

猜你喜欢

热点阅读