You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trustieforge/public/javascripts/wechat/directives/iphone_recognize.js

33 lines
1.3 KiB

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