socialforge/public/javascripts/wechat/directives/iphone_recognize.js

33 lines
1.3 KiB
JavaScript
Raw Normal View History

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