【发布时间】:2021-03-25 19:19:17
【问题描述】:
我正在使用 webview_flutter 来显示网页。我正在使用下面的代码来检测平台,比如它是 android 还是 ios。我下面的代码不起作用。 Flutter webview - https://pub.dev/packages/webview_flutter 我在正文中添加了以下类。
class - view-withKeyboard
function applyAfterResize() {
console.log(getMobileOperatingSystem());
if (getMobileOperatingSystem() == 'ios') {
if (originalPotion !== false) {
var wasWithKeyboard = $('body').hasClass('view-withKeyboard');
var nowWithKeyboard = false;
var diff = Math.abs(originalPotion - ($(window).width() + $(window).height()));
if (diff > 100) nowWithKeyboard = true;
$('body').toggleClass('view-withKeyboard', nowWithKeyboard);
if (wasWithKeyboard != nowWithKeyboard) {
//onKeyboardOnOff(nowWithKeyboard);
}
}
}
}
$(document).on('focus blur', '.white-div input[type=text]', function(e){
//alert('here');
if (getMobileOperatingSystem() == 'ios') {
var $obj = $(this);
var nowWithKeyboard = (e.type == 'focusin');
$('body').toggleClass('view-withKeyboard', nowWithKeyboard);
onKeyboardOnOff(nowWithKeyboard);
}
});
【问题讨论】:
-
您能否向我们展示一下您如何使用 WebView 小部件。
标签: javascript html css flutter