Skip to content

Commit

Permalink
refactor: TOC nowrap
Browse files Browse the repository at this point in the history
  • Loading branch information
MOxFIVE committed Jun 5, 2016
1 parent 73ea4ac commit 6b1f010
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 6 additions & 5 deletions layout/_partial/toc.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@
</script>

<% if (theme.toc_nowrap) { %>
<script>
$(document).ready(function() {
$(".toc li a").mouseover(function() {
var title = $(this).find('.toc-text').text();
$(".toc li a").each(function(){
var title = $(this).find('.toc-text').text();
// Find elements with ellipsis
if (this.offsetWidth < this.scrollWidth) {
$(this).attr("title", title);
});
if (!!$().tooltip) { $(this).tooltip() }
}
})
</script>
<% } %>
3 changes: 3 additions & 0 deletions source/css/_partial/article.styl
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ if hexo-config("toc_nowrap")
text-overflow ellipsis
white-space nowrap
overflow-x hidden
li.toc-item
line-height: 1.45em


.copyright {
width: 85%;
Expand Down

0 comments on commit 6b1f010

Please sign in to comment.