var oH=0;
mui.plusReady(function() {
initNativeObjects();
showSoftInput();
if(plus.os.name=="Android"){
}else{
var iosH=plus.screen.resolutionWidth*plus.screen.scale;
if(iosH==640){ //iphone5
oH=screen.height-271;
}
if(iosH==750){ //iphone6
oH=screen.height-258;
}
if(iosH==1080){ //iphone6 plus
oH=screen.height-226;
}
}
});
function goFooter(oh){
$('.say-menu').animate({'bottom':oh},200);
$('.text-sum').animate({'bottom':oh+50},200);
}
$(function(){
/*var x=20,oH=$(window).height(); alert(oH);
$(window).on('resize',function(){
var oH2=$(window).height();alert(oH2);
});*/
$("textarea").on('blur',function(){
$('.say-menu').animate({'bottom':0},200);
$('.text-sum').animate({'bottom':50},200);
});
$("textarea").on('focus',function(){
$('.say-menu').animate({'bottom':oH},200);
$('.text-sum').animate({'bottom':oH+50},200);
});
});
var nativeWebview, imm, InputMethodManager;
var initNativeObjects = function() {
if (mui.os.android) {
var main = plus.android.runtimeMainActivity();
var Context = plus.android.importClass("android.content.Context");
InputMethodManager = plus.android.importClass("android.view.inputmethod.InputMethodManager");
imm = main.getSystemService(Context.INPUT_METHOD_SERVICE);
} else {
nativeWebview = plus.webview.currentWebview().nativeInstanceObject();
}
};
var showSoftInput = function() {
var nativeWebview = plus.webview.currentWebview().nativeInstanceObject();
if (mui.os.android) {
//强制当前webview获得焦点
plus.android.importClass(nativeWebview);
nativeWebview.requestFocus();
imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
} else {
nativeWebview.plusCallMethod({
"setKeyboardDisplayRequiresUserAction": false
});
}
setTimeout(function() {
//此处可写具体逻辑设置获取焦点的input
var inputElem = document.querySelector('textarea');
inputElem.focus();
goFooter(oH);
}, 200);
};
7***@qq.com
- 发布:2017-04-07 17:58
- 更新:2019-03-24 10:30
- 阅读:3769
6 个评论
要回复文章请先登录或注册
kevinxu
bishuihanshan
EthanQu
9494
9494
DCloud_heavensoft