一只特立独行的猪

  • Home
  • Web
  • SoftWare
  • Media
  • Life
    • 水深火热

解决键盘弹出后挡表单的问题

  • moxiaonai
  • 2018-05-24
  • 0

解决键盘弹出后挡表单的问题

    window.addEventListener('resize', function() {
      if(
        document.activeElement.tagName === 'INPUT' ||
        document.activeElement.tagName === 'TEXTAREA'
      ) {
        window.setTimeout(function() {
          if('scrollIntoView' in document.activeElement) {
            document.activeElement.scrollIntoView();
          } else {
            document.activeElement.scrollIntoViewIfNeeded();
          }
        }, 0);
      }
    });
© 2023 一只特立独行的猪
Theme by Wing
  • {{ item.name }}
  • {{ item.name }}