From 4e9474f9826f9a164a7412686fdd05734bcf1d81 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Mon, 9 Sep 2013 13:48:49 -0500 Subject: [PATCH 1/2] Revert "Scroll page to top when prev/next clicked." This reverts commit 6b71d8de35c2c49dad1dc65fe39f25c5298941be. It should be done in manageNextPrev() instead. --- tutorial/index.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/tutorial/index.html b/tutorial/index.html index e5b53b072..7e262cfff 100644 --- a/tutorial/index.html +++ b/tutorial/index.html @@ -457,13 +457,11 @@ manageNextPrev(); $('a#next').click(function(e) { e.preventDefault(); location.href = $('.nav li.active').nextAll('li:not(.nav-header)').first().find('a').attr('href'); - $('html,body').scrollTop(0); manageNextPrev(); }); $('a#previous').click(function(e) { e.preventDefault(); location.href = $('.nav li.active').prevAll('li:not(.nav-header)').first().find('a').attr('href'); - $('html,body').scrollTop(0); manageNextPrev(); }); From d3952b60af0908d5e5ee010d1e936549536ea106 Mon Sep 17 00:00:00 2001 From: Yihui Xie Date: Mon, 9 Sep 2013 13:54:44 -0500 Subject: [PATCH 2/2] whenever manageNextPrev() is called, the page should scroll to top this should also happen in hashchange() so that clicking on the links in the left navigation panel will bring the page to top --- tutorial/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/tutorial/index.html b/tutorial/index.html index 7e262cfff..7c68c7352 100644 --- a/tutorial/index.html +++ b/tutorial/index.html @@ -451,6 +451,7 @@ hljs.initHighlightingOnLoad(); function manageNextPrev() { $('a#next').parent().toggleClass('disabled', $('.nav li.active').nextAll('li:not(.nav-header)').size() == 0); $('a#previous').parent().toggleClass('disabled', $('.nav li.active').prevAll('li:not(.nav-header)').size() == 0); + $('html,body').scrollTop(0); } manageNextPrev();