For my navigation bar, I have it so that when I click on one of the items, my css class "current-menu-item" is activated. This works to a certain extent. My Jquery code is as follows:
$(document).ready(function(){
$("li.menu").click(function(){
$("li.menu").removeClass("current-menu-item");
$(this).addClass("current-menu-item");
});
});
This is the rails link_to:
<li class="menu">
<%= link_to "home", root_url %>
</li>
The only problem with this is that this code executes BEFORE the redirect. So I can only quickly see the class activate for a brief second before the new page loads and it is removed.
What is the easiest way to solve this dilemma?