alsotang e1d88c50cf Revert "Revert "修复宽屏下footer没有固定在底部的Bug""
This reverts commit 31e45b82c3e4a73b0d38ecec89489efcfc73c524.
2016-06-13 22:42:57 +08:00

54 lines
1.3 KiB
JavaScript

$(document).ready(function () {
var windowHeight = $(window).height();
var $backtotop = $('#backtotop');
var top = windowHeight - $backtotop.height() - 200;
function moveBacktotop() {
$backtotop.css({ top: top, right: 0});
}
function footerFixBottom() {
if($(document.body).height() < windowHeight){
$("#footer").addClass('fix-bottom');
}else{
$("#footer").removeClass('fix-bottom');
}
}
$backtotop.click(function () {
$('html,body').animate({ scrollTop: 0 });
return false;
});
$(window).scroll(function () {
var windowHeight = $(window).scrollTop();
if (windowHeight > 200) {
$backtotop.fadeIn();
} else {
$backtotop.fadeOut();
}
});
moveBacktotop();
footerFixBottom();
$(window).resize(moveBacktotop);
$(window).resize(footerFixBottom);
$('.topic_content a,.reply_content a').attr('target', '_blank');
// pretty code
prettyPrint();
// data-loading-text="提交中"
$('.submit_btn').click(function () {
$(this).button('loading');
});
// 广告的统计信息
$('.sponsor_outlink').click(function () {
var $this = $(this);
var label = $this.data('label');
ga('send', 'event', 'banner', 'click', label, 1.00, {'nonInteraction': 1});
});
});