移动端解决fixed和input获取焦点软键盘弹出影响定位的问题

 

 

 

 

js代码为:

//底部固定
    function fixedWatch(t){
          if(document.activeElement.nodeName=='INPUT'){
               t.css({position:"static",bottom:"auto","margin-top":"-53px"})
          }else{
             t.css({position:"fixed",bottom:"0"});
             if(window.res){
               clearInterval(window.res);
               window.res=null;
             }  
          }
     }
     if(isIOS){
          $(".fixedComment input").focus(function(){
               if(!window.res){
                  fixedWatch($(".fixedComment"));
                  window.res=setInterval(function(){
                    fixedWatch($(".fixedComment"));
                  },500); 
               }
          });    
     }

 

http://blog.csdn.net/kongjiea/article/details/46545351

 

https://www.douban.com/note/341635041/

posted @ 2016-09-04 00:08  chenguiya  阅读(286)  评论(0)    收藏  举报