[jQuery] ajax loaded content and selecting current page show in navigation
So I have an issue, I want to highlight the link which is currently
being viewed. The content is loaded via the LOAD method, but when I
click on the other links the added class still remains and highlights
them all. I want to highlight just the current loaded page and not the
others.
Here is the script I am working with:
$(document).ready(function(){
$("div#header_nav ul li a").click(function(){
//var getTitle = $(this).attr('title');
$('div#contentWrapper').hide('slow',loadContent);
var toLoad = $(this).attr('href')+' #contentWrapper';
function loadContent() {
$('div#contentWrapper').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('div#contentWrapper').animate({opacity: 'toggle', height:
'toggle'});
}
return false;
});
});
The navigation is just an UL list. As you can see i was trying to do
an IF statement based on the Title attribute of the links.
Any help will be greatly appreciated, I have been at this for a while
now.
Thanks.