This commit is contained in:
2019-05-30 18:52:14 +08:00
commit aa360a22bf
341 changed files with 30369 additions and 0 deletions

View File

@ -0,0 +1,9 @@
$(document).ready(function() {
function updateFooterPosition() {
var containerHeight = $('#footer').attr('position') ? $('.container').height() + $('#footer').outerHeight(true) : $('.container').height();
if (containerHeight < window.innerHeight) $('#footer').css({ 'position': 'fixed', 'bottom': 0, 'left': 0, 'right': 0 }).attr('position', 'fixed');
else $('#footer').removeAttr('style position');
}
updateFooterPosition();
$(window).on('resize scroll', updateFooterPosition);
});

View File

@ -0,0 +1,57 @@
/* global NexT, CONFIG */
$(document).ready(function() {
var sidebarInner = $('.sidebar-inner');
var sidebarOffset = CONFIG.sidebar.offset || 12;
function getHeaderOffset() {
return $('.header-inner').height() + sidebarOffset;
}
function getFooterOffset() {
var footer = $('#footer');
var footerInner = $('.footer-inner');
var footerMargin = footer.outerHeight() - footerInner.outerHeight();
var footerOffset = footer.outerHeight() + footerMargin;
return footerOffset;
}
function initAffix() {
var headerOffset = getHeaderOffset();
var footerOffset = getFooterOffset();
var sidebarHeight = $('#sidebar').height() + NexT.utils.getSidebarb2tHeight();
var contentHeight = $('#content').height();
// Not affix if sidebar taller than content (to prevent bottom jumping).
if (headerOffset + sidebarHeight < contentHeight) {
sidebarInner.affix({
offset: {
top : headerOffset - sidebarOffset,
bottom: footerOffset
}
});
sidebarInner.affix('checkPosition');
}
$('#sidebar').css({ 'margin-top': headerOffset, 'margin-left': 'auto' });
}
function recalculateAffixPosition() {
$(window).off('.affix');
sidebarInner.removeData('bs.affix').removeClass('affix affix-top affix-bottom');
initAffix();
}
function resizeListener() {
var mql = window.matchMedia('(min-width: 992px)');
mql.addListener(function(e) {
if (e.matches) {
recalculateAffixPosition();
}
});
}
initAffix();
resizeListener();
});