Permalink
Browse files

refactor: TOC nowrap

  • Loading branch information...
1 parent 73ea4ac commit 6b1f010ccc781793bcce0c750d50fc9f4fe25f80 @MOxFIVE committed Jun 5, 2016
Showing with 9 additions and 5 deletions.
  1. +6 −5 layout/_partial/toc.ejs
  2. +3 −0 source/css/_partial/article.styl
@@ -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>
<% } %>
@@ -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%;

0 comments on commit 6b1f010

Please sign in to comment.