Current class on on the actual dropdown toggle button in navbar?


Not sure if it’s possible or I’m doing something wrong, but here it goes: When I use a dropdown in the navbar, is there a way to set a “current style” on the dropdown button itself, not just on the selected buttons in the dropdown list? When used in the navbar, after the user have clicked on a button in the dropdown list and the list is closed, it would be great if the dropdown button could indicate that “a-button-in-this-dropdown-list-is-selected”


1 Like

You have to use custom code for this. Paste in Site Footer Code, then add the class dropdown-active to your dropdown and style this class.

$('.w-dropdown').each(function() {
  var hasActiveLink = $(this).find('.w--current').length > 0;
  $(this).find('.w-dropdown-toggle').addBack().toggleClass('dropdown-active', hasActiveLink);

Also, feel free to contact me for further code help and/or customization of third-party plugins


Thanks for your reply @samliew, I’m not in the office next week, but will try this as soon as I’m back :+1:


Hi again @samliew

So, I have added your code to the custom code area… and it flip’in worked! :smiley: Thanks for your time!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.