iphone端输入框js控制

This commit is contained in:
Tim 2016-08-23 10:23:55 +08:00
parent 8b6e6fec87
commit bbc0277d39
1 changed files with 10 additions and 3 deletions

View File

@ -8,9 +8,16 @@ app.directive('iphoneRecognize',function(){
link: function(scope, element){ link: function(scope, element){
var userAgent = navigator.userAgent; var userAgent = navigator.userAgent;
if (/ipad|iphone|mac/i.test(navigator.userAgent)){ if (/ipad|iphone|mac/i.test(navigator.userAgent)){
element.css({"position":"relative","padding":"1px 0"}); $("#postInput1").bind('focus',function(){
$(".post-wrapper").css("margin-bottom","0"); element.css({"position":"relative","padding":"1px 0"});
$("#all_homework_reply").css("margin-bottom","0"); $(".post-wrapper").css("margin-bottom","0");
$("#all_homework_reply").css("margin-bottom","0");
});
$("#postInput1").bind('blur',function(){
element.css("position","fixed");
$(".post-wrapper").css("margin-bottom","10px");
$("#all_homework_reply").css("margin-bottom","50px");
});
} }
} }
} }