zoukankan      html  css  js  c++  java
  • iOS唤起input慢

    在JS中添加如下代码即可:
    FastClick.attach(document.body); //300ms延迟
    //init
    /**
      * @param {EventTarget|Element} targetElement
      */
    FastClick.prototype.focus = function (targetElement) {
        var length;
    
        // Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
        if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month' && targetElement.type !== 'email') {
            length = targetElement.value.length;
            targetElement.focus();//加入这一句话就OK了
            targetElement.setSelectionRange(length, length);
        } else {
            targetElement.focus();
        }
    };
  • 相关阅读:
    html5 悬浮提示框
    ajax 接收json
    ajax 发送参数
    jquery无刷新请求ajax
    jQuery 发送 ajax json 请求
    html5 三级联动菜单
    iframe 用法
    html5 复制文字
    bootstrap表单按回车会自动刷新页面的问题
    jquery版本不兼容问题
  • 原文地址:https://www.cnblogs.com/zhangxin123/p/11912257.html
Copyright © 2011-2022 走看看