Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    418
    Thanks
    18
    Thanked 2 Times in 2 Posts

    javascript not running animation second time

    I have a javascript animation sequence that includes the changing of <li> background images in the navigation. Everything works fine, when the page loads. If I click one of the navigation links, the javascript runs another animation and changes the background url of the selected menu item.

    This all works fine, except the navigation rollovers from the first script no longer work.

    ( I tried doing things with css rollovers, and the same problem occured. )

    Here's the script:
    Code:
    // 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*/ });
    	
    				
    			$('#link_nest').css('background-image', 'url("http://thewalshgroup.ca/dev/the-next/images/navigation/menu_theNext2.png")');
    			$('#link_hillcrest').css('background-image', 'url("http://thewalshgroup.ca/dev/the-next/images/navigation/menu_hill1.png")');
    			$('#link_3little').css('background-image', 'url("http://thewalshgroup.ca/dev/the-next/images/navigation/menu_3LittleBx1.png")');
    			$('#link_early').css('background-image', 'url("http://thewalshgroup.ca/dev/the-next/images/navigation/menu_earlyBirdRegistration1.png")');
    			$('#link_contact').css('background-image', 'url("http://thewalshgroup.ca/dev/the-next/images/navigation/menu_contact1.png")');
    				
    
    			
    	// other unrelated actions
    								
    		}
    Last edited by turpentyne; 03-26-2013 at 09:28 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •