initial
This commit is contained in:
9
themes/next/source/js/schemes/muse.js
Normal file
9
themes/next/source/js/schemes/muse.js
Normal 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);
|
||||
});
|
57
themes/next/source/js/schemes/pisces.js
Normal file
57
themes/next/source/js/schemes/pisces.js
Normal 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();
|
||||
});
|
Reference in New Issue
Block a user