Skip to content

Commit

Permalink
FIX: sidebar scrollable in all schemes [22].
Browse files Browse the repository at this point in the history
Not affix if sidebar taller then content (to prevent bottom jumping).
  • Loading branch information
ivan-nginx committed Sep 28, 2017
1 parent 22569da commit 1280837
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions source/js/src/schemes/pisces.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@ $(document).ready(function () {

function initAffix () {
var headerOffset = getHeaderOffset(),
footerOffset = getFooterOffset();

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

setSidebarMarginTop(headerOffset).show();
footerOffset = getFooterOffset(),
sidebarHeight = $('#sidebar').height() + NexT.utils.getSidebarb2tHeight(),
contentHeight = $('#content').height();

// Not affix if sidebar taller then content (to prevent bottom jumping).
if (headerOffset + sidebarHeight < contentHeight) {
sidebarInner.affix({
offset: {
top: headerOffset - CONFIG.sidebar.offset,
bottom: footerOffset
}
});
}

setSidebarMarginTop(headerOffset).css({ 'margin-left': 'initial' });
}

function resizeListener () {
Expand Down

1 comment on commit 1280837

@stevenjoezhang
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.