Learn how to use jQuery at the Blog

Naked Ambition « visit

  • Added 8 months ago
  • 315 Lines of Code shown
  • 1 Links of Interest
http://nakedambition.com
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Naked Ambition - http://nakedambition.com

					$('#girls #movie-overlay').hover(function(){
						$(this).effect("shake", { distance:2, times:1 }, 100);
					});
					$('#girls #book-overlay').hover(function(){
						$(this).effect("shake", { distance:2, times:1 }, 100);
					});




					var safariHeight = $('#wrap').outerHeight();
					var frameHeight = $(window).height();
					$('#wrap .content-wrap').height(safariHeight);
					$('#overlay').css({'top': '20%'});	
					function postFilter() {
						$('.content-nav li a').click(function() {
							$('.content-nav li a').removeClass('active');
							$(this).addClass('active');
								
							var filterClass = $(this).text();
								
							$('.post').each(function(){
									
								if($(this).hasClass(filterClass)) {
									$(this).slideDown('slow');
								} else {
									if( filterClass == 'all') {
										if($(this).is(':hidden')) {$(this).slideDown('slow')}
									} else {
										$(this).slideUp('slow');
									};
								};
							});
							return false;
							
						});
					}
					postFilter();	




				$('#overlay').hide(); // hide the flyout
				$('.content-nav li a em').each(function() { //get each content nav
					contentNavClass = $(this).text(); // read the link text
					$(this).parent().addClass(contentNavClass); // apply the class to the parent
				});
				
				function brightenTheLights() {
					$('#lights-out').fadeOut('slow', function() { 
						$('#lights-out').css({'opacity': 1});
						$('#lights-out').remove(); 
						
					});
				};
					
							
				function dimTheLights() {
					$('#wrap').prepend('<div id="lights-out"></div>');
					$('#lights-out').css({'opacity': 0});
					$('#lights-out').animate({
						opacity : 0.6,
					}, 700);
				};
				
				function getAnchor(){ // parse the url
					var url = window.location.hash; // get everything after the #
					
					if(url == '#trailer') {movieClick() }; // if its trailer, show the trailer
					if(url == '#book') {bookClick() }; // if its book, show the book
					
					// todo: store detection should be more modular
					if(url == '#tickets') { // if its tickets (store)
						$('.content-nav li a.tickets').addClass('active'); 
						$('.content-nav li a.all').removeClass('active');
						$('.post').each(function(){
							if($(this).hasClass('tickets')) {
								$(this).slideDown('slow');
							} else {
								$(this).slideUp('slow');
							}
						})
					};
					if(url == '#books') { // if its books (store)
						$('.content-nav li a.books').addClass('active'); 
						$('.content-nav li a.all').removeClass('active');
						$('.post').each(function(){
							if($(this).hasClass('books')) {
								$(this).slideDown('slow');
							} else {
								$(this).slideUp('slow');
							}
						})
					};
					if(url == '#prints') { // if its books (store)
						$('.content-nav li a.prints').addClass('active'); 
						$('.content-nav li a.all').removeClass('active');
						$('.post').each(function(){
							if($(this).hasClass('prints')) {
								$(this).slideDown('slow');
							} else {
								$(this).slideUp('slow');
							}
						})
					};
					if(url == '#ppv') { // if its ppv (store)
						$('.content-nav li a.ppv').addClass('active'); 
						$('.content-nav li a.all').removeClass('active');
						$('.post').each(function(){
							if($(this).hasClass('ppv')) {
								$(this).slideDown('slow');
							} else {
								$(this).slideUp('slow');
							}
						})
					};
					if(url == '#soundtrack') { // if its soundtrack (store)
						$('.content-nav li a.soundtrack').addClass('active'); 
						$('.content-nav li a.all').removeClass('active');
						$('.post').each(function(){
							if($(this).hasClass('soundtrack')) {
								$(this).slideDown('slow');
							} else {
								$(this).slideUp('slow');
							}
						})
					};
					if(url == '#apps') { // if its apps (store)
						$('.content-nav li a.apps').addClass('active'); 
						$('.content-nav li a.all').removeClass('active');
						$('.post').each(function(){
							if($(this).hasClass('apps')) {
								$(this).slideDown('slow');
							} else {
								$(this).slideUp('slow');
							}
						})
					};
				}; // end getAnchor

				getAnchor(); // init the function
				
				function arrowOut(){
					$('#tag-line').hide("slide", 
						{ direction: "left" },
						650);
				};
				
				function arrowIn(){
					$('#tag-line').show("slide", 
						{ direction: "left" },
						650);
				};
				
				function closeOverlay(){
				
					$('.close').hide();	
					$('#overlay').hide("slide", { 
						direction: "down" 
					}, 650);
					
					$('.temp-loader').remove();
						return false;
				};

				function bookClick() {
					$('a.r-rating').hide();		
					if ($('#overlay').is(':hidden')) {
						dimTheLights();
						arrowOut();
					}

					if ($('#overlay:visible').hasClass('movie-toggle')) {
						closeOverlay();
						
	
						
						
						
					}
					if ($('#overlay:visible').hasClass('book-toggle')) {
						$('#overlay').hide("slide", 
						{ direction: "down" },
						650);
						brightenTheLights();
						
						$('#tag-line').show("slide", 
						{ direction: "left" },
						650);
						
						return false;
					}
					
					
					
					$('.close').hide();
					
					
					$('#overlay').removeClass('movie-toggle');
					$('#overlay').addClass('book-toggle');
					$('a.switch-tabs').text('Go To The Movie');
					$('#overlay').show("slide", 
						{ direction: "down" },
						650, function() { $('.close').fadeIn('slow') } );
					return false;
				};
				
				function movieClick() {
					$('a.r-rating').show();
					$('.temp-loader').remove();
					if ($('#overlay').is(':hidden')) {
						dimTheLights();
						arrowOut();
					}
					
					if ($('#overlay:visible').hasClass('book-toggle')) {
		
						closeOverlay();
						
					}
		
					
				
					if ($('#overlay:visible').hasClass('movie-toggle')) {
						$('#overlay').hide("slide", 
						{ direction: "down" },
						650);
						
						brightenTheLights();
						
						$('#tag-line').show("slide", 
						{ direction: "left" },
						650);
						
					
						return false;
					};
					
						
				

					$('.close').hide();
					$('#overlay').removeClass('book-toggle');
					$('#overlay').addClass('movie-toggle');
					$('a.switch-tabs').text('Go To The Book');
					
					$('#overlay').show("slide", 
						{ direction: "down" },
						650, function() { 
							$('.close').fadeIn('slow');
							$('#vid-player').prepend('<div class="temp-loader"></div>');
							$('.temp-loader').load('trailer.php');
						 }
					);
					return false;
				};
				
					
				
				$('.close').click(function(){
					closeOverlay();
					arrowIn();
					brightenTheLights();
					return false;
				});
				
				function textShake() {
					$('#tag-line-text').effect("shake", { times:2 }, 700);
				};	
				
				textShake();
				
				$('#book-overlay').click(function(){
					bookClick();
					return false;
				});
			
				$('#movie-overlay').click(function(){
					movieClick();
					return false;
				});
				
				$('#nav li.book a').click(function(){
					bookClick();
					return false;
				});
				
				$('#nav li.movie a').click(function(){
					movieClick();
					return false;
				});
				
				$('#collectors-ed a').click(function(){
					brightenTheLights();
					closeOverlay();
				});
				
				$('#vid-copy a').click(function(){
					brightenTheLights();
					closeOverlay();
				});
				
				$('a.switch-tabs').click(function(){
					$('#tag-line').hide();
					
					if($('#overlay').hasClass('movie-toggle')) {
						bookClick();
					
						return false;
					} else {
						movieClick();
						
						return false;
					};
				});