I want to add the active
class in the anchor tag on behalf after the last dash (-
) of URL. because I have two URL
http://www.example.com/information-pages
http://www.example.com/information-blog
I'm using this script. It's is working well, but I want to add the active
class after the last -
var path = window.location.pathname.split("/").pop();
var target = $('a[href*="' + path + '"]');
target.addClass('active');
Aucun commentaire:
Enregistrer un commentaire