重构脚本:优化task.js脚本,增加footer方法,使网站页脚自动布局

This commit is contained in:
Argo-MacBookPro 2018-09-07 16:43:11 +08:00
parent 8189a594a0
commit cee319a110
3 changed files with 11 additions and 12 deletions

View File

@ -259,7 +259,7 @@
return this;
},
footer: function (options) {
if ($(window).width() >= 768) { this.addClass('fixed'); return this; }
if ($(window).width() >= 768) { return this.addClass('fixed'); }
var op = $.extend({ header: "header", content: ".main-content" }, options);
return $(op.header).outerHeight() + $(op.content).outerHeight() + this.outerHeight() > $(window).height() ? this.removeClass('fixed') : this.addClass('fixed');
},

View File

@ -1,4 +1,6 @@
$(function () {
$('.site-footer').footer();
var $table = $('table').smartTable({
url: Notifications.url + "newusers",
sidePagination: "client",

View File

@ -1,10 +1,11 @@
$(function () {
var $btnRefresh = $('#refreshTask');
var $footer = $('.site-footer').footer();
var htmlTask = '<li class="list-primary"><i class="fa fa-ellipsis-v"></i><div class="task-title notifi"><span class="task-title-sp">{0}</span><span class="task-value">{1}</span><span class="task-time">{2}</span><div class="pull-right hidden-phone"><button class="btn btn-success btn-xs fa fa-check" data-id="{3}" data-result="1"></button><button class="btn btn-danger btn-xs fa fa-remove" data-id="{3}" data-result="0" data-placement="left" data-original-title="拒绝授权"></button></div></div></li>';
function listData() {
$btnRefresh.toggleClass('fa-spin');
$('#refreshTask').on('click', function () {
var that = $(this);
that.toggleClass('fa-spin');
$.bc({
url: Tasks.url, method: 'GET', swal: false,
callback: function (result) {
@ -14,13 +15,9 @@
}).join('');
$('#list-task').html(content);
}
$btnRefresh.toggleClass('fa-spin');
that.toggleClass('fa-spin');
$footer.footer();
}
});
}
listData();
$btnRefresh.on('click', function () {
listData();
});
})
}).trigger('click');
});