aboutsummaryrefslogtreecommitdiffstats
path: root/doc/toc.html
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-12-27 19:57:53 -0500
committerAndrew Manning <tamanning@zoho.com>2016-12-27 19:57:53 -0500
commit95683c6239bacf71fa180b883ea8969a09bc1885 (patch)
tree2f5a3548e5c327948ebb4cd03e2b69f475504d9d /doc/toc.html
parentd29bd4b0548241e0b80ffae63c458df7b2236259 (diff)
downloadvolse-hubzilla-95683c6239bacf71fa180b883ea8969a09bc1885.tar.gz
volse-hubzilla-95683c6239bacf71fa180b883ea8969a09bc1885.tar.bz2
volse-hubzilla-95683c6239bacf71fa180b883ea8969a09bc1885.zip
Add webpage doco to Member guide. Add nav menu highlighting when scrolling past content
Diffstat (limited to 'doc/toc.html')
-rw-r--r--doc/toc.html27
1 files changed, 24 insertions, 3 deletions
diff --git a/doc/toc.html b/doc/toc.html
index ba26d17e3..68be9f5b8 100644
--- a/doc/toc.html
+++ b/doc/toc.html
@@ -67,7 +67,7 @@
</div>
</div>
<script>
-
+ toc = {};
// Generate the table of contents in the side nav menu (see view/tpl/help.tpl)
$(document).ready(function () {
$(".panel-collapse.in").find('a').each(function(){
@@ -88,8 +88,29 @@
}
});
- $(document.body).trigger("sticky_kit:recalc");
+ $(document.body).trigger("sticky_kit:recalc");
+
+ toc.contentTop = [];
+ toc.edgeMargin = 20; // margin above the top or margin from the end of the page
+ toc.topRange = 200; // measure from the top of the viewport to X pixels down
+ // Set up content an array of locations
+ $('#doco-side-toc').find('a').each(function(){
+ toc.contentTop.push( $( '#'+$(this).attr('href').split('#').pop() ).offset().top );
+ });
- });
+ // adjust side menu
+ $(window).scroll(function(){
+ var winTop = $(window).scrollTop(),
+ bodyHt = $(document).height(),
+ vpHt = $(window).height() + toc.edgeMargin; // viewport height + margin
+ $.each( toc.contentTop, function(i,loc){
+ if ( ( loc > winTop - toc.edgeMargin && ( loc < winTop + toc.topRange || ( winTop + vpHt ) >= bodyHt ) ) ){
+ $('#doco-side-toc li')
+ .removeClass('selected-doco-nav')
+ .eq(i).addClass('selected-doco-nav');
+ }
+ });
+ });
+ });
</script>