Html input loses focus on Samsung Android when vir

2019-08-15 04:04发布

I have the problem of losing focus on an input element on a Samsung Galaxy Tab A (Android 7.0) with a html5 web application. It seems to be a problem in android, as on windows 10 or iOS (although the resize event is also triggered when the virtual keyboard pops up) the element does not lose focus. Windows 10 and iOS apparently suppress this when the virtual keyboard is called (but not when manually resizing the browser window). Anybody any help on this?

1条回答
放我归山
2楼-- · 2019-08-15 04:27

It's an Android issue losing focus due to the resize() event.

Have you tried something like this for your resize functionality if something is not in focus:

$(window).bind('resize', function() {

    if ($("input").is(":focus")) {
        // Nothing will happen
    } else {
        // Other resize functions
    }
});
查看更多
登录 后发表回答