Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
problem with jquery animation
Old 04-28-2011, 07:01 AM problem with jquery animation
Skilled Talker

Posts: 72
Location: singapore
Trades: 0
Hi i have a website www.mexztest.com/novelnew
see my homepage i am using jquery to animate when mouse over.
but the problem is when i mouseout and mouse in to another button too fast the style seems to be mess around.
someone please help me.
here is my jquery code:

Code:
			
			$j('#slider-wrapper ul.slider-button li a.pri').mouseout(function(){
				
				// hide away all shown stuffs.
				$j('#slider-wrapper .school-bubble-title .bubble-title-pri').stop(true,true).css({width : 1, height:1}).hide(1);
				$j('img#slider1').stop(true,true).css({width : 1, height : 1, marginLeft:250, marginTop:-110}).hide(1);
				$j('.pribubble p, .pribubble h3').stop(true,true).css({fontSize:1}).hide(1);
				$j('.pribubble').stop(true,true).css({width : 1, height : 1, marginLeft : 1}).hide(1);
				// end of hiding
				
				
				$j('#anilogo').show().animate(
  					{width:"302",height:"209",marginLeft:"100",marginTop:"30"},
					{duration: '1',complete:function(){
						$j('#aniarrow').show().animate(
  							{width:"225",height:"88",marginLeft:"120",marginTop:"-90"},
							{duration:'1',easing:'easeOutExpo',complete:function(){
								$j('#anitext').show().animate(
									{width:"171",height:"25",marginLeft:"190",marginTop:"-30"},
										500
					  				);
								}}
							 );
						}}				
					);
				});

			
			
		
		$j('#slider-wrapper ul.slider-button li a.pri').mouseover(function(){
		
			$j('#anilogo').stop();
			$j('#aniarrow').stop();
			$j('#anitext').stop();
			
			// hide logo set////////////////////////////////////////////////////
			$j('#anilogo').css({width:1,height:1,marginLeft:200,marginTop:220}).hide(1);
			$j('#aniarrow').css({width:225,height:88,marginLeft:400,marginTop:-90}).hide(1);
			$j('#anitext').css({width:1,height:1,marginLeft:190,marginTop:80}).hide(1);
			// end hiding////////////////////////////////////////////////////
			
			setTimeout ( function(){
                
                	$j('img#slider1').show().animate({width:"467",height:"283",marginLeft:"0",marginTop:"0"},{
                    	
                    	easing: 'easeOutBounce'
                	});
                },500);
           	setTimeout(function(){
           	
           		
           		$j('.pribubble').show().animate({width:"147",height:"235",marginLeft:"0"},{
                   	duration: '2000',
                    easing: 'easeOutBounce'
               	});
                $j('.pribubble h3').animate({fontSize:"13"},{
                    duration: '500',
                	easing: 'easeOutBounce'
                });
                		
                $j('.pribubble p').show().stop(true, true).animate({fontSize:"12"},{
                    duration: '500',
                    easing: 'easeOutBounce'
                });
            },100);
            
            setTimeout ( function(){
            		$j('.bubble-title-pri').show();
                	$j('.bubble-title-pri').stop(true, true).animate({width:"220",height:"68",marginLeft:"0"},{
                    	duration: '2000',
                    	easing: 'easeOutBounce'
                	});
                	$j('.bubble-title-pri h1').stop(true, true).animate({fontSize:"18"},{
                    	duration: '1000',
                    	easing: 'easeOutBounce'
                	});
                },500);
		});
		
		
//////////////////////////////////////////////////// //////////Button 2 ////////////////////////////////////////////////////	
	
		$j('#slider-wrapper ul.slider-button li a.sec').mouseover(function(){
			
			
			$j('#anilogo').stop();
			$j('#aniarrow').stop();
			$j('#anitext').stop();
			
			// hide away the logo set////////////////////////////////////////////////////
			$j('#anilogo').css({width:1,height:1,marginLeft:200,marginTop:220}).hide(1);
			$j('#aniarrow').css({width:225,height:88,marginLeft:400,marginTop:-90}).hide(1);
			$j('#anitext').css({width:1,height:1,marginLeft:190,marginTop:80}).hide(1);
			// end hiding////////////////////////////////////////////////////////////////
			
			setTimeout ( function(){
                
                	$j('img#slider2').show().stop(true, true).animate({width:"467",height:"283",marginLeft:"0",marginTop:"0"},{
                    	
                    	easing: 'easeOutBounce'
                	});
                },500);
           	setTimeout(function(){
           	
           		
           		$j('.secbubble').show().stop(true, true).animate({width:"147",height:"235",marginLeft:"0"},{
                   	duration: '2000',
                    easing: 'easeOutBounce'
               	});
                $j('.secbubble h3').stop(true, true).animate({fontSize:"13"},{
                    duration: '500',
                	easing: 'easeOutBounce'
                });
                		
                $j('.secbubble p').show().stop(true, true).animate({fontSize:"12"},{
                    duration: '500',
                    easing: 'easeOutBounce'
                });
            },100);
            
            setTimeout ( function(){
            		$j('.bubble-title-sec').show();
                	$j('.bubble-title-sec').stop(true, true).animate({width:"220",height:"68",marginLeft:"0"},{
                    	duration: '2000',
                    	easing: 'easeOutBounce'
                	});
                	$j('.bubble-title-sec h1').stop(true, true).animate({fontSize:"18"},{
                    	duration: '1000',
                    	easing: 'easeOutBounce'
                	});
                },500);
		});
		
		$j('#slider-wrapper ul.slider-button li a.sec').mouseout(function(){
				
				$j('img#slider2').stop(true, true);
				// hide away all shown stuffs.
				$j('#slider-wrapper .school-bubble-title .bubble-title-sec').css({width : 1, height:1}).hide(1);
				$j('img#slider2').css({width : 1, height : 1, marginLeft:250, marginTop:-110}).hide(1);
				$j('.secbubble p, .secbubble h3').css({fontSize:1}).hide(1);
				$j('.secbubble').css({width : 1, height : 1, marginLeft : 1}).hide(1);
				
				
				// end of hiding
				$j('#anilogo').stop(true, true).show().animate(
  					{width:"302",height:"209",marginLeft:"100",marginTop:"30"},
  					{duration: '2000',complete:function(){
  						$j('#aniarrow').stop(true, true).show().animate(
  							{width:"225",height:"88",marginLeft:"120",marginTop:"-90"},
  							{duration:'1000',easing:'easeOutExpo',complete:function(){
								$j('#anitext').show().animate(
									{width:"171",height:"25",marginLeft:"190",marginTop:"-30"},
										200
					  				);
  						}}
  						);
  					}}
  					);
				
			});
			
		
//////////////////////////////////////////////////////////// Button 3 //////////////////////////////////////////////////////////// 
	$j('#slider-wrapper ul.slider-button li a.jc').mouseover(function(){
	
			$j('#anilogo').stop();
			$j('#aniarrow').stop();
			$j('#anitext').stop();
			// hide away logo set////////////////////////////////////////////////////
			$j('#anilogo').css({width:1,height:1,marginLeft:200,marginTop:220}).hide(1);
			$j('#aniarrow').css({width:225,height:88,marginLeft:400,marginTop:-90}).hide(1);
			$j('#anitext').css({width:1,height:1,marginLeft:190,marginTop:80}).hide(1);
			//end hiding.//////////////////////////////////////////////////////////////
			
			setTimeout ( function(){
                
                	$j('img#slider3').stop(true, true).show().animate({width:"467",height:"283",marginLeft:"0",marginTop:"0"},{
                    	
                    	easing: 'easeOutBounce'
                	});
                },500);
           	setTimeout(function(){
           	
           		
           		$j('.jcbubble').stop(true, true).show().animate({width:"147",height:"235",marginLeft:"0"},{
                   	duration: '2000',
                    easing: 'easeOutBounce'
               	});
                $j('.jcbubble h3').stop(true, true).animate({fontSize:"13"},{
                    duration: '500',
                	easing: 'easeOutBounce'
                });
                		
                $j('.jcbubble p').stop(true, true).show().animate({fontSize:"12"},{
                    duration: '500',
                    easing: 'easeOutBounce'
                });
            },100);
            
            setTimeout ( function(){
            		$j('.bubble-title-jc').show();
                	$j('.bubble-title-jc').stop(true, true).animate({width:"220",height:"68",marginLeft:"0"},{
                    	duration: '2000',
                    	easing: 'easeOutBounce'
                	});
                	$j('.bubble-title-jc h1').stop(true, true).animate({fontSize:"18"},{
                    	duration: '1000',
                    	easing: 'easeOutBounce'
                	});
                },500);
		});
		
		$j('#slider-wrapper ul.slider-button li a.jc').mouseout(function(){
				
				$j('img#slider3').stop();
				// hide away all shown stuffs.
				$j('#slider-wrapper .school-bubble-title .bubble-title-jc').css({width : 1, height:1}).hide(1);
				$j('img#slider3').css({width : 1, height : 1, marginLeft:250, marginTop:-110}).hide(1);
				$j('.jcbubble p, .jcbubble h3').css({fontSize:1}).hide(1);
				$j('.jcbubble').css({width : 1, height : 1, marginLeft : 1}).hide(1);
				
				// end of hiding
				$j('#anilogo').stop(true, true).show().animate(
  					{width:"302",height:"209",marginLeft:"100",marginTop:"30"},
  					{duration: '2000',complete:function(){
  						$j('#aniarrow').stop(true, true).show().animate(
  							{width:"225",height:"88",marginLeft:"120",marginTop:"-90"},
  							{duration:'1000',easing:'easeOutExpo',complete:function(){
								$j('#anitext').stop(true, true).show().animate(
									{width:"171",height:"25",marginLeft:"190",marginTop:"-30"},
										200
					  				);
  						}}
  						);
  					}}
  					);
				
			});
__________________

Please login or register to view this content. Registration is FREE
zelllibin is offline
Reply With Quote
View Public Profile Visit zelllibin's homepage!
 
 
Register now for full access!
Old 04-28-2011, 08:16 AM Re: problem with jquery animation
Extreme Talker

Posts: 246
Trades: 0
Have a variable that states that an animation is running and to not run any other animation until that one is completed.

so in sudo code something like this:

if(!isAnimationRunning){
runAnimation(function(){
isAnimationRunning = true;
},
{completed: function(){
isAnimationRunning = false;
}});
}

Also take a look at the queue(), dequeue() and clearQueue() methods for jQuery they might help.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 04-29-2011, 06:25 AM Re: problem with jquery animation
Skilled Talker

Posts: 72
Location: singapore
Trades: 0
any live code guide?
sorry new to jquery thing
__________________

Please login or register to view this content. Registration is FREE
zelllibin is offline
Reply With Quote
View Public Profile Visit zelllibin's homepage!
 
Old 04-29-2011, 02:56 PM Re: problem with jquery animation
Extreme Talker

Posts: 246
Trades: 0
http://api.jquery.com/category/effects/ for the queue methods.

This code is completely untested and is just a thought on what you can do.

Code:
//global variable to say whether an animation is complete
var isAnimationRunning = false;

$('somebutton').click(function() {
    //check to see if there are any animations running
    //if not, it is safe to run another animation
    if(!isAnimationRunning){
        //set this to false 
        isAnimationRunning = true;

        $('someimage').animate({'cssProperty': 'cssValue'}, 5000, function() {
            //set this to false upon completion so that other animations can run
            isAnimationRunning = false;
        });
    }
});
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 05-02-2011, 11:48 AM Re: problem with jquery animation
Skilled Talker

Posts: 72
Location: singapore
Trades: 0
thanks cheers.
__________________

Please login or register to view this content. Registration is FREE
zelllibin is offline
Reply With Quote
View Public Profile Visit zelllibin's homepage!
 
Reply     « Reply to problem with jquery animation
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25424 seconds with 12 queries