javascript - How can I add a class to the active menu item using bootstrap scrollspy? -


i'm using code, doesn't work expecting.

$("#mynavbar").on("activate.bs.scrollspy", function(){     $(this).parent('li').addclass('hvr-overline-reveal');     var currentitem = $(".nav li.active > a");     currentitem.parent("li").addclass("hvr-pulse");     currentitem.addclass("hvr-overline-reveal"); })  }); 

the main issue this:

$("#mynavbar").on("activate.bs.scrollspy", function(){ } 

it activates jquery when scroll page. how can add class li element when occurs?

https://jsfiddle.net/hnk9w/12/

use code

$('body').scrollspy({ target: '#navbar-example' }); 

replace navbar example navbar read documentation : http://getbootstrap.com/javascript/#scrollspy


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -