Closed sama55 closed 4 years ago
I solved this in the following method. First, when generating sidebar HTML, add ID(e.g. #slimscrollstart) to the selected menu. Second: I added following Javascript.
$(document).ready(function(){ // Customize SlimScroll if($('#slimscrollstart').length != 0) { var sidebar_rect = $(".sidebar-scrollbar").get(0).getBoundingClientRect(); var target_rect = $('#slimscrollstart').get(0).getBoundingClientRect(); var scroll_position = target_rect.top - sidebar_rect.top - 10; $(".sidebar-scrollbar").slimScroll({ scrollTo : scroll_position + 'px' }); } });
Now, no matter what page is displayed, sidebar is shown from the top. Can I show selected menu at the top?