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:
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
}
});