简体   繁体   中英

iscroll4 prevents keyboard display on focus on an extern input (android/ios)

I have a problem with iScroll on android (2.2/2.3 and ios)

I have a code which looks like :

<input id = "thing" val=""/>
    <div id="scroller" style="overflow:auto; height:150px;">
        <ul>
            <li><a class="thing">thing</a></li>
            <li><a class="thing">thing</a></li>
            <li><a class="thing">thing</a></li>
            <li><a class="thing">thing</a></li>
            <li><a class="thing">thing</a></li>
            <li><a class="thing">thing</a></li>
            <li><a class="thing">thing</a></li>
            <li><a class="thing">thing</a></li>
            <li><a class="thing">thing</a></li>
            <li><a class="thing">thing</a></li>
        </ul>
    </div>
    <a class="thing">thing</a>

and the js :

$( document ).ready( function(e) {
    var testScroll = new iScroll('scroller', {vScrollbar: false});
    $('a.thing').on('click', function(){$('#thing').focus();});
};

when I click on the lone link, I give focus on #thing input and the soft keyboard appear. when I click on those in the scroller, focus is given but the keyboard don't appear.

I really don't understand what don't works here. I'd like to make the keyboard appear.

edit: I'm using jquery mobile, if that can help helping me.

try to tell if the target is an input element, modify the '_start' function in iscroll.js:

_start: function (e) {
    var that = this,
    point = hasTouch ? e.changedTouches[0] : e,
    matrix;

    that.moved = false;

    if ( e.target.tagName == "SELECT" || e.target.tagName == "INPUT"
        || e.target.tagName == "BUTTON" || e.target.tagName == "TEXTAREA") {
        return true;
    }

    e.preventDefault();

    // more codes here

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM