diff --git a/index.tmpl b/index.tmpl index fc9a8b4b..8d5f7f18 100644 --- a/index.tmpl +++ b/index.tmpl @@ -15,6 +15,10 @@ /* hide the main content while we assemble everything */ .md-hidden-load { display: none; } + #md-content h1:hover::after, #md-content h2:hover::after, + #md-content h3:hover::after, #md-content h4:hover::after { + content: ' \B6'; + } /* for pageContentMenu */ #md-page-menu { position: static; diff --git a/js/basic_skeleton.js b/js/basic_skeleton.js index bd934f4f..532ba058 100644 --- a/js/basic_skeleton.js +++ b/js/basic_skeleton.js @@ -11,7 +11,9 @@ $.md.stage('all_ready').subscribe(function(done) { if ($.md.inPageAnchor !== '') { - $.md.scrollToInPageAnchor($.md.inPageAnchor); + $.md.util.wait(500).then(function () { + $.md.scrollToInPageAnchor($.md.inPageAnchor); + }); } done(); }); @@ -155,6 +157,10 @@ $('h1,h2,h3,h4,h5,h6').each (function () { var $heading = $(this); $heading.addClass('md-inpage-anchor'); + $heading.click (function (){ + var subhash = $heading.text().replace(' ', '_'); + window.location.hash = '#!' + $.md.mainHref + '#' + subhash; + }); //var name = $.trim ($heading.text ()); //var $anchor1 = $('').attr ('name', name).addClass('md-inpage-anchor md-inpage-anchor-space'); @@ -206,9 +212,8 @@ var match = $this.text().toLowerCase().replace(/ /g, '_'); if (spaceAnchor === match || underscoreAnchor === match) { this.scrollIntoView (true); - // TODO actually figure the real height of the navbar, because - // custom themes may have different height - window.scrollBy(0, -50); + var navbar_offset = $('.navbar-collapse').height() + 5; + window.scrollBy(0, -navbar_offset + 5); doBreak = true; } }); diff --git a/js/main.js b/js/main.js index 83e946e7..f03e97e2 100644 --- a/js/main.js +++ b/js/main.js @@ -411,7 +411,7 @@ } // extract possible in-page anchor - var ex_pos = href.indexOf('!'); + var ex_pos = href.indexOf('#'); if (ex_pos !== -1) { $.md.inPageAnchor = href.substring(ex_pos + 1); $.md.mainHref = href.substring(0, ex_pos);