vjeantet / hugo-theme-docdock

Declination of @matcornic Learn theme to Hugo
https://docdock.netlify.com/
MIT License
586 stars 316 forks source link

content position can''t follow current doc page #176

Open kanghaiyang opened 5 years ago

kanghaiyang commented 5 years ago

with following code, we can fix the issue.

docdock/static/theme-flex/script.js
@@ -170,6 +170,15 @@ jQuery(document).ready(function() {
     });

     $('article a:not(:has(img)):not(.btn)').addClass('highlight');
+
+    // Fix the scroll's position for the actived content node.
+    try {
+        if( $('.menu .active').offset() ) {
+            var offset = $('.menu .active').offset().top - $('header').height() - 50;
+            $('article > aside').scrollTop(offset);
+        }
+    } catch (e) {}
+
 });
Pilskalns commented 5 years ago

Hi @kanghaiyang,

Could you please expand more what exactly is the issue and how to repeat it?

Thanks!