input ios键盘遮挡

直接放代码

 

// 获取焦点
focusInput() {
  let commentDom = document.querySelector('#textarea')
  setTimeout(function() {
    commentDom.scrollIntoView(true);
    commentDom.scrollIntoViewIfNeeded();
  }, 500)
},

在使用的input 或者textarea 需要被键盘顶起来,被顶起来的容器元素id为textarea

以上如果还不可以,在做第二步操作:给这个元素设置position:sticky

 

posted @ 2019-08-27 15:24  IT婷婷  阅读(484)  评论(0编辑  收藏  举报