Skip to content

Commit

Permalink
ADD: sidebar scrollable in all schemes [3].
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-nginx authored Sep 23, 2017
1 parent 334e50e commit 59209cf
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions source/js/src/schemes/pisces.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
$(document).ready(function () {
var $headerInner = $('.header-inner');
var $sidebar = $('#sidebar');
var getSidebarTop = function(){
return $headerInner.height() + CONFIG.sidebar.offset;
};
var setSidebarMarginTop = function(sidebarTop){
return $sidebar.css({ 'margin-top': sidebarTop });
};
var mql = window.matchMedia('(min-width: 991px)');
setSidebarMarginTop(getSidebarTop()).show();
mql.addListener(function(e){
if(e.matches){
setSidebarMarginTop(getSidebarTop());
}
});

initAffix();

function initAffix () {
var headerHeight = $('.header-inner').height(),
headerOffset = (headerHeight + CONFIG.sidebar.offset)

footerInner = $('.footer-inner'),
footerMargin = footerInner.outerHeight(true) - footerInner.outerHeight(),
footerOffset = footerInner.outerHeight(true) + footerMargin;

$('.sidebar-inner').affix({
offset: {
top: headerOffset - CONFIG.sidebar.offset,
bottom: footerOffset
}
});

$('#sidebar').css({ 'margin-top': headerOffset + 'px' }).show();
}
});

0 comments on commit 59209cf

Please sign in to comment.