ios自动定位输入框
This commit is contained in:
parent
11f3060ca5
commit
7fe1394403
|
@ -9,24 +9,28 @@ app.directive('iphoneRecognize',["$timeout",function(timer){
|
||||||
timer(function(){
|
timer(function(){
|
||||||
var contentHeight = $(".post-container").height();
|
var contentHeight = $(".post-container").height();
|
||||||
var toBottom = function(){
|
var toBottom = function(){
|
||||||
element.css({"position":"relative","padding":"1px 0"});
|
element.css({"position":"absolute","padding":"1px 0","marginBottom":"-50px"});
|
||||||
$(".post-wrapper").css("marginBottom","0");
|
$(".post-wrapper").css({"marginBottom":"0","position":"relative"});
|
||||||
$("#all_homework_reply").css("marginBottom","0");
|
$("#all_homework_reply,#all_blog_reply,#all_course_message_reply,#all_message_reply").css("marginBottom","0");
|
||||||
window.scrollTo(0,contentHeight);
|
window.scrollTo(0,contentHeight)
|
||||||
};
|
};
|
||||||
if (/ipad|iphone|mac/i.test(navigator.userAgent)){
|
// if (/ipad|iphone|mac/i.test(navigator.userAgent)){
|
||||||
$("#postInput1").bind('focus',function(){
|
$("#postInput1").bind('focus',function(){
|
||||||
toBottom();
|
setTimeout(function(){
|
||||||
|
toBottom();
|
||||||
|
},200);
|
||||||
});
|
});
|
||||||
$("#postInput1,#replyBlock").bind("click",function(){
|
$("#postInput1,#replyBlock").bind("click",function(){
|
||||||
toBottom();
|
setTimeout(function(){
|
||||||
|
toBottom();
|
||||||
|
},200);
|
||||||
});
|
});
|
||||||
$("#postInput1").bind('blur',function(){
|
$("#postInput1").bind('blur',function(){
|
||||||
element.css("position","fixed");
|
element.css({"position":"fixed","marginBottom":"0"});
|
||||||
$(".post-wrapper").css("marginBottom","10px");
|
$(".post-wrapper").css({"marginBottom":"10px","position":""});
|
||||||
$("#all_homework_reply").css("marginBottom","50px");
|
$("#all_homework_reply,#all_blog_reply,#all_course_message_reply,#all_message_reply").css("marginBottom","52px");
|
||||||
});
|
});
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue