ok so here is what i am trying to do. i have a navLink class that has ID 1 through x (in this case it is 5, but the idea is that i can add to it if needed). As well as Divs under the Selection class, 1Div through xDiv. The div's toggle, as well as the navlinks changing color as if it was using CSS active tag. This works great when I was using Home div and I didn't want one of the link to start as active. Now that i am trying to do that I need to be able to store the given selector in the 'active' var. Also I am trying to make it so when clicking navLink number 3 it goes to a different page, i run into the same problem. I am a bit new to JavaScript so i am not to sure how JS stores variables. Here is the code:
$(function() {
var active = $('#1');
$('.selection').hide();
$('#1Div').show();
$('.navLink').hover(
function() {
$(this).css("color","#806ac7");
},
function() {
if(this === active) {
$(this).css("color","#961014");
} else {
$(this).css("color","#000000");
}
});
$('.navLink').click(function(e){
active = this;
$('.navLink').css("color","#000000");
$(this).css("color","#961014");
if(this == '#3') {
location.href = "./Contact.html"
} else {
$('.selection').hide();
$('#'+ this.id + 'Div').show();
}
});
});
Thanks ahead of time you guys here at stack are a great help.
EDIT:
Thanks for the help so far. As requested here is the link to an example: http://jsfiddle.net/fgj6H/ everything is working but there link on navlink 3 still looking for help with that.