@cryptotaxi247 / netdata-1 / commits / 7f0783edd

fix for scrollspy offset selecting wrong menu item; fixes #2356

Costa Tsaousis (ktsaou) committed Nov 18, 2017 at 23:00 UTC 7f0783eddcd6eec9c7125f35aedf60662108f677
1 file changed +6 -4
web/index.html
+6 -4
@@ -3720,9 +3720,11 @@
3720 });
3721
3722 /* activate bootstrap scrollspy (needed for sidebar) */
3723 - var scrollspyOffset = $(window).height() / 5;
3724 - if(scrollspyOffset > 200) scrollspyOffset = 200;
3725 - if(scrollspyOffset < 50) scrollspyOffset = 50;
3723 + var scrollspyOffset = $(window).height() / 3;
3724 + if(scrollspyOffset > 250) scrollspyOffset = 250;
3725 + if(scrollspyOffset < 75) scrollspyOffset = 75;
3726 + document.body.setAttribute('data-offset', scrollspyOffset);
3727 + // console.log(scrollspyOffset);
3728 $(document.body).scrollspy({
3729 target: '#sidebar',
3730 offset: scrollspyOffset // controls the diff of the <hX> element to the top, to select it
@@ -4093,7 +4095,7 @@
4095 </script>
4096 </head>
4097
4096 -<body data-spy="scroll" data-target="#sidebar">
4098 +<body data-spy="scroll" data-target="#sidebar" data-offset="100">
4099 <div id="loadOverlay" class="loadOverlay" style="background-color: #888; color: #888;">
4100 netdata<br/><div style="font-size: 3vh;">Real-time performance monitoring, done right!</div>
4101 </div>