文章来源:https://www.cnblogs.com/lichunyan/p/8214600.html

 

一:全局

1.阻止弹出层下面的页面滚动

给弹出层的最外层标签上加@touchmove.prevent

 

二:ipone

1.readonly与disabled

 在iphone下,输入框为readonly时,点击依然会获得焦点;

建议设为disabled

2.button在iphone下会有默认自带的样式和圆角

-webkit-appearance: none;清除自带样式

3.button,a,img等点击时会高亮,去除方式如下:

-webkit-tap-highlight-color:rgba(255,255,255,0);

4.不兼容new date("2017-09-08 00:00:00")  这种写法,需要把‘-’换成‘/’:

var date="2017-09-08 00:00:00"

new Date(date.replace(/-/g, "/"))

 

 

三:android

1.输入框获取焦点时,软键盘会遮挡,主动触发让输入框上移

前端开发采坑之安卓和ios的兼容问题
if (/Android/gi.test(navigator.userAgent)) {
    window.addEventListener('resize', function () {
        if (document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA') {
            window.setTimeout(function () {
                document.activeElement.scrollIntoViewIfNeeded();
            }, 0);
        }
    })
}

相关文章:

  • 2021-11-28
  • 2021-08-15
  • 2021-11-15
  • 2022-01-19
  • 2021-10-05
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2021-06-15
相关资源
相似解决方案