2016-08-22 16:50:14 +08:00
|
|
|
/**
|
|
|
|
* Created by ttang on 2016/8/22.
|
|
|
|
*/
|
2016-08-25 14:30:42 +08:00
|
|
|
app.directive('iphoneRecognize',["$timeout",function(timer){
|
2016-08-22 16:50:14 +08:00
|
|
|
return{
|
|
|
|
restrict: 'A',
|
|
|
|
scope: {},
|
|
|
|
link: function(scope, element){
|
2016-08-25 14:30:42 +08:00
|
|
|
timer(function(){
|
|
|
|
var contentHeight = $(".post-container").height();
|
2016-08-29 11:32:11 +08:00
|
|
|
var toBottom = function(){
|
2016-09-02 16:34:33 +08:00
|
|
|
element.css({"position":"absolute","padding":"1px 0","marginBottom":"-50px"});
|
|
|
|
$(".post-wrapper").css({"marginBottom":"0","position":"relative"});
|
|
|
|
$("#all_homework_reply,#all_blog_reply,#all_course_message_reply,#all_message_reply").css("marginBottom","0");
|
|
|
|
window.scrollTo(0,contentHeight)
|
2016-09-01 13:36:27 +08:00
|
|
|
};
|
2016-09-02 16:35:16 +08:00
|
|
|
if (/ipad|iphone|mac/i.test(navigator.userAgent)){
|
2016-08-29 11:32:11 +08:00
|
|
|
$("#postInput1").bind('focus',function(){
|
2016-09-02 16:34:33 +08:00
|
|
|
setTimeout(function(){
|
|
|
|
toBottom();
|
|
|
|
},200);
|
2016-08-29 11:32:11 +08:00
|
|
|
});
|
2016-09-01 13:36:27 +08:00
|
|
|
$("#postInput1,#replyBlock").bind("click",function(){
|
2016-09-02 16:34:33 +08:00
|
|
|
setTimeout(function(){
|
|
|
|
toBottom();
|
|
|
|
},200);
|
2016-09-01 13:36:27 +08:00
|
|
|
});
|
2016-08-29 11:32:11 +08:00
|
|
|
$("#postInput1").bind('blur',function(){
|
2016-09-02 16:34:33 +08:00
|
|
|
element.css({"position":"fixed","marginBottom":"0"});
|
|
|
|
$(".post-wrapper").css({"marginBottom":"10px","position":""});
|
|
|
|
$("#all_homework_reply,#all_blog_reply,#all_course_message_reply,#all_message_reply").css("marginBottom","52px");
|
2016-08-29 11:32:11 +08:00
|
|
|
});
|
2016-09-02 16:35:16 +08:00
|
|
|
}
|
2016-08-25 14:30:42 +08:00
|
|
|
})
|
2016-08-22 16:50:14 +08:00
|
|
|
}
|
|
|
|
}
|
2016-08-25 14:30:42 +08:00
|
|
|
}]);
|