Authored by 张孝茹

软键盘档输入框

... ... @@ -78,7 +78,7 @@
<div class="title">身高</div>
<div class="main">
<label>cm</label>
<input class="inp inp-2 height modify" type="number" value="{{height}}" />
<input class="inp inp-2 height modify bottom-out" type="number" value="{{height}}" />
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
... ... @@ -88,7 +88,7 @@
<div class="title">体重</div>
<div class="main">
<label>kg</label>
<input class="inp inp-2 weight modify" type="number" value="{{weight}}" />
<input class="inp inp-2 weight modify bottom-out" type="number" value="{{weight}}" />
</div>
<div class="arr">
<span class="iconfont">&#xe604;</span>
... ...
... ... @@ -29,6 +29,7 @@ class UserInfo extends Page {
$cityText: $('.city-text'),
$userPic: $('.user-pic'),
$noDate: $('.inp.modify[type!=date]'),
$bottomOut: $('.bottom-out')
};
this.view = {
... ... @@ -82,6 +83,9 @@ class UserInfo extends Page {
this.selector.$chosenCity.on('DOMNodeInserted', this.modifyInp.bind(this));
this.selector.$userPic.on('click', this.userPic.bind(this));
this.selector.$modifyInp.on('click', this.closeCitySwiper.bind(this));
this.selector.$bottomOut.on('focus', this.keepOut.bind(this));
this.selector.$bottomOut.on('blur', this.restore.bind(this));
if (yoho.isApp) {
this.selector.$modifyInp.on('change', this.modifyInp.bind(this));
} else {
... ... @@ -98,6 +102,25 @@ class UserInfo extends Page {
}
}
keepOut(e) {
let $this = $(e.currentTarget);
$('body').css({
height: $(window).height() + $this.offset().top * 2 / 3
});
$(document).scrollTop($this.offset().top * 2 / 3);
}
restore() {
$('body').css({
height: $(window).height()
});
$(document).scrollTop(0);
}
userPic() {
if (yoho.isApp) {
yoho.ready(() => {
... ...