How to change navigation menu class to selected, when you have clicked on it?
It works fine, when I'm use --> ul li and a tag without span
See it on action: http://jsfiddle.net/diskzzokejs/VkKJF/3/
Bouth of examples works fine, but in span class="header_item_before" and span class="header_item_after" I have a images. H开发者_运维技巧ow to keep images on change? And last tab bottom corner must be without image.
Change this:
$("ul li:last").addClass(function() {
return "last_tab selected";
});
to this:
$(".tab_header_item").removeClass("selected");
$(this).closest(".tab_header_item").addClass("selected");
Your updated fiddle.
This is what you need:
$(this).parents('li').addClass('selected').siblings().removeClass('selected');
http://jsfiddle.net/AlienWebguy/VkKJF/6/
精彩评论