Skip to content

Commit

Permalink
fix: add scorllbar when TOC too long, #120
Browse files Browse the repository at this point in the history
  • Loading branch information
ahonn committed Mar 10, 2017
1 parent 48f8f34 commit 8fea653
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion source/css/_partial/_post/_toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
box-shadow: 1px 1px 2px rgba(0,0,0,0.125);
word-wrap: break-word;
box-sizing: border-box;
max-height: calc(100% - 40px);
overflow-y: auto;

.post-toc-title {
margin: 0 10px;
Expand Down Expand Up @@ -44,4 +46,4 @@
.post-toc {
display: none;
}
}
}
8 changes: 4 additions & 4 deletions source/js/src/even.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@
var isLastOne = i + 1 === $toclink.length,
currentTop = headerlinkTop[i] - HEADERFIX,
nextTop = isLastOne ? Infinity : headerlinkTop[i+1] - HEADERFIX;

if (currentTop < scrollTop && scrollTop <= nextTop) {
$($toclink[i]).addClass('active')
$($toclink[i]).addClass('active');
} else {
$($toclink[i]).removeClass('active')
$($toclink[i]).removeClass('active');
}
}
});
Expand All @@ -111,7 +111,7 @@
if ($.fancybox){
$('.post').each(function () {
$(this).find('img').each(function () {
$(this).wrap('<a class="fancybox" href="' + this.src + '" title="' + this.alt + '"></a>')
$(this).wrap('<a class="fancybox" href="' + this.src + '" title="' + this.alt + '"></a>');
});
});

Expand Down

0 comments on commit 8fea653

Please sign in to comment.