I've got a bit of javascript that changes the background image of a div on hover. Then, when they click on a link, the page rearranges, and the clicked menu item changes background image to show which section they're on. (the page never reloads).
Unfortunately, after they click, the hover function stops working. It only works on page load.
Here's what I have:
// first, here's the beginning animation.
// the part I can't get to work after they've clicked something, is the
$(".square.one,#link_next").hover(function(){
if (!$(".square.one").hasClass('animated') && !$(".square.one").hasClass('subbed')) {
$(".square.one").dequeue().stop().animate({ width:"155px",height:"219px" },240);
$('#link_next').css('background-image', 'url("http://site.com/dev/images/navigation/menu_2.png")');
$("#pic_1_color").animate({ opacity:"0" },50);
$("#square_caption2,#square_caption3,#square_caption4").css('visibility','hidden');
$('#square_caption1') .delay(150).queue( function(next){
$(this).css('visibility','visible');
next();
});
}
}, function() {
if (!$(".square.one,#link_next").hasClass('subbed')) {
$("#square_caption1").css('visibility','hidden');
$(".square.one").addClass('animated').animate({ width:$width_one, height:$height_one }, "normal", "linear", function() {
$('#link_next').css('background-image', 'url("http://site.com/dev/images/navigation/menu_1.png")');
$("#pic_1_color").animate({ opacity:"1" },90);
$("#square_caption1").css('visibility','hidden');
$(this).removeClass('animated').dequeue();
});
};
});
}
// several other links, then...
else if ( $(this).hasClass('') ) {
};
function pic_shift(){
$("#testit").removeClass("main_page");
if ( $(this).hasClass('active') || $(this).hasClass('aa')) {
$('.article,.the-next,.home-register').stop().animate({ opacity: 0 }, 20, function() {
$('.reg1').css("line-height","1.5em");
$('.details .article').unload();
});
$('#link_next').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_theNext1.png")');
$('#link_hill').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_hill1.png")');
$('#link_3little').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_3LittleBx1.png")');
$('#link_early').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_earlyBirdRegistration1.png")');
$('#link_contact').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_contact1.png")');
});
// several other unrelated actions.
});
} else if ( $(this).hasClass('one') || $(this).hasClass('ee')) {
$('.article').stop().animate({ opacity: 0 }, 100, function() {
$('.details .article').load('inc/the-page2.php');
$('.article,h3').stop().animate({ left: '259px', top:'190px',width:'400px'}, 20, function() {
$('.article,h3').stop().animate({ opacity: 1 }, 1800, function() { /*animation completed*/ });
});
});
$('.mappits').stop().animate({ opacity: 0 }, 1, function() { /*animation completed*/ });
$('#nest_thumbs_1,#nest_thumbs_2,#nest_thumbs_3').stop().animate({ opacity: 0 }, 10, function() { /*animation completed*/ });
// with these changes below, the animation on the first 25 lines, stops working
$('#link_nest').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_theNext2.png")');
$('#link_hillcrest').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_hill1.png")');
$('#link_3little').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_3LittleBx1.png")');
$('#link_early').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_earlyBirdRegistration1.png")');
$('#link_contact').css('background-image', 'url("http://site.ca/dev/the-next/images/navigation/menu_contact1.png")');
// other unrelated actions
}