Sidebar - highlight navigated sidebar item on page load - dynamically highlight sidebar item as user navigates
This commit is contained in:
parent
c224536472
commit
5a2cd55414
|
@ -15,13 +15,38 @@ var loader_html = '<div class="preloader"> \
|
|||
|
||||
$(document).ready(function () {
|
||||
remove_init_form();
|
||||
|
||||
/* Remove 'active' class from 'li' items */
|
||||
setTimeout(function(){
|
||||
$('li.active').removeClass("active");
|
||||
|
||||
$('.list > li').each(function(){
|
||||
var href = $(this).find('a').attr("href");
|
||||
if(typeof href !== "undefined"){
|
||||
// console.log(href);
|
||||
// console.log(document.location.pathname);
|
||||
|
||||
if(href == document.location.pathname){
|
||||
$(this).addClass("active");
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
|
||||
/*
|
||||
* When a sidebar item is clicked - let's make sure we set the active/inactive components
|
||||
*/
|
||||
|
||||
$(document).on('on_pjax_click', function (e, href) {
|
||||
$('li.active').removeClass("active");
|
||||
href.parent('li').addClass("active");
|
||||
});
|
||||
|
||||
/*
|
||||
* When a sidebar item is clicked in mobile - let's make sure we push the sidebar back in
|
||||
*/
|
||||
|
||||
$(document).on('on_pjax_complete', function () {
|
||||
$(document).on('on_pjax_complete', function (e) {
|
||||
if ($('.ls-closed').length > 0) {
|
||||
$('body').removeClass('overlay-open');
|
||||
$('.overlay').css("display", "none");
|
||||
|
|
|
@ -41,10 +41,10 @@ function connect_websocket() {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Note: the only thing I stream currently is dhcp log - so later incoming messages will need to be
|
||||
keyed by their "type" via json
|
||||
*/
|
||||
/*
|
||||
Note: the only thing I stream currently is dhcp log - so later incoming messages will need to be
|
||||
keyed by their "type" via json
|
||||
*/
|
||||
|
||||
var grep_value = document.getElementById("grep_fitler").value;
|
||||
|
||||
|
|
|
@ -64,6 +64,8 @@ $('body').on('click', 'a', function (e) {
|
|||
|
||||
do_pjax_request(request_url);
|
||||
|
||||
$( document ).trigger( "on_pjax_click", [$(this)]);
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue