diff --git a/docs/js/doc.js b/docs/js/doc.js
index <HASH>..<HASH> 100644
--- a/docs/js/doc.js
+++ b/docs/js/doc.js
@@ -150,9 +150,13 @@
 
   function tocMenu(){
     $('.toc-menu select').change(function(){
+      var $body = $('body');
       var href = $(this).val();
+      var scroll0 = $body.scrollTop();
       window.location.hash = href;
-      $('html, body').animate({scrollTop: '-=100px'}, 800);
+      var scroll1 = $body.scrollTop();
+      var deltaScroll = scroll1 - scroll0;
+      $body.scrollTop($body.scrollTop() - (deltaScroll>0?200:0)).animate({scrollTop: (deltaScroll>0?'+':'-')+'=100px'}, 300)
     });
   }
docs(live-doc): in mobile view, makes menu moves consistent with pos