Created
April 4, 2014 17:27
-
-
Save Bardyl/9979196 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Open and close overlay | |
$('#gammes div p a').on('click', function(e){ | |
e.preventDefault(); | |
// Defaults overlay | |
$('#overlay nav ul li').removeClass('active'); | |
$('#overlay nav ul li:first-child').addClass('active'); | |
$('.left').fadeOut(0); | |
$('.left-03').fadeIn(300); | |
$('.right-content').fadeOut(0); | |
$('.right-3').fadeIn(0); | |
$('#overlay').fadeIn(800); | |
}); | |
$('span.close').on('click', function(){ | |
$('#overlay').fadeOut(800); | |
}); | |
$('.gamme').fadeOut(0); | |
$('.gamme-n2').fadeIn(0); | |
$('#technos ul:last-child li').fadeOut(0); | |
$('#productlist nav').fadeOut(0); | |
$('#productlist nav').fadeOut(0); | |
$('#productlist nav.pdts-gamme-n2.geo').fadeIn(0); | |
$('#productlist nav:last-child').fadeOut(0); | |
$('.product-desc').fadeOut(0); | |
$('.product-1').fadeIn(0); | |
$('.coupe .vue').fadeOut(300); | |
$('.coupe .coupe-1').fadeIn(300); | |
$('.carac').fadeOut(300); | |
$('.carac-product-1').fadeIn(300); | |
$('span.rem3').fadeOut(0); | |
$('.remarque').fadeOut(300); | |
$('.remarque-1').fadeIn(300); | |
// Changement du contenu de l'overlay | |
$('#overlay nav ul li').on('click', function(){ | |
var liId = $(this).data('id'); | |
$('#overlay nav ul li').removeClass('active'); | |
$(this).addClass('active'); | |
$('#overlay #tableau p.geometry-type > span > span > span').removeClass('active'); | |
$('#overlay #tableau p.geometry-type > span > span:nth-child('+liId+') span').addClass('active'); | |
$('.left').fadeOut(300); | |
$('.left-0'+liId).delay(300).fadeIn(); | |
$('.right-content').fadeOut(300); | |
$('.right-'+liId).delay(300).fadeIn(); | |
}); | |
// gammes | |
$('#gammes > nav ul li').on('click', function(){ | |
var gamme = $(this).data('gamme'); | |
$('#gammes > nav ul li').removeClass('active'); | |
$(this).addClass('active'); | |
$('.gamme').fadeOut(0); | |
$('.gamme-'+gamme).fadeIn(0); | |
if(gamme == 'n2') | |
{ | |
// Changement technos | |
$('li.g-n3').fadeOut(300); | |
$('li.g-n2').fadeIn(300); | |
// Réinitialisation de la techno active (geo) | |
$('#technos nav ul li').removeClass('active'); | |
$('#technos nav ul li:first-child').addClass('active'); | |
// Réinitialisation des produits de la techno | |
$('#productlist nav.pdts-gamme-n3').fadeOut(); | |
$('#productlist nav.pdts-gamme-n2.geo').fadeIn(); | |
$('#productlist nav ul li').removeClass('active'); | |
$('#productlist nav ul li:first-child').addClass('active'); | |
$('#productlist nav ul li').fadeIn(); | |
$('section#product').animate({ | |
height: '860px' | |
}, 100); | |
$('.product-desc').fadeOut(300); | |
$('.product-1').fadeIn(300); | |
$('.vue').fadeOut(0); | |
$('.coupe-1').fadeIn(300); | |
$('span.rem3').fadeOut(300); | |
$('.carac').fadeOut(300); | |
$('.carac-product-1').fadeIn(300); | |
$('.remarque').fadeOut(300); | |
$('.remarque-1').fadeIn(300); | |
$('.infos h4').fadeIn(300); | |
$('#technos').slideDown(); | |
$('#productlist').slideDown(); | |
$('#product').slideDown(); | |
} | |
else if(gamme == 'n3') | |
{ | |
$('li.g-n2').fadeOut(300); | |
$('li.g-n3').fadeIn(300); | |
$('#technos nav ul li').removeClass('active'); | |
$('#technos nav ul li:first-child').addClass('active'); | |
$('#productlist nav.pdts-gamme-n2').fadeOut(); | |
$('#productlist nav.pdts-gamme-n3.geo').fadeIn(); | |
$('#productlist nav ul li').removeClass('active'); | |
$('#productlist nav ul li:first-child').addClass('active'); | |
$('#productlist nav ul li').fadeIn(); | |
$('section#product').animate({ | |
height: '920px' | |
}, 100); | |
$('.product-desc').fadeOut(0); | |
$('.product-7').fadeIn(300); | |
$('.vue').fadeOut(0); | |
$('.coupe-7').fadeIn(300); | |
$('span.rem3').fadeIn(300); | |
$('.carac').fadeOut(300); | |
$('.carac-product-7').fadeIn(300); | |
$('.remarque').fadeOut(300); | |
$('.remarque-7').fadeIn(300); | |
$('.infos h4').fadeIn(300); | |
$('.coupe h4').fadeIn(300); | |
$('#technos').slideDown(); | |
$('#productlist').slideDown(); | |
$('#product').slideDown(); | |
} | |
else if(gamme == 'n5') | |
{ | |
$('li.g-n3').fadeOut(300); | |
$('li.g-n2').fadeOut(300); | |
$('#productlist nav').fadeOut(); | |
$('.product-desc').fadeOut(0); | |
$('.vue').fadeOut(300); | |
$('span.rem3').fadeOut(300); | |
$('.carac').fadeOut(300); | |
$('.remarque').fadeOut(300); | |
$('.infos h4').fadeOut(300); | |
$('.coupe h4').fadeOut(300); | |
$('#technos').slideUp(); | |
$('#productlist').slideUp(); | |
$('#product').slideUp(); | |
} | |
else | |
{ | |
throw 'imposible!'; | |
} | |
}); | |
// Technos | |
$('#technos nav ul li').on('click', function(){ | |
var techno = $(this).data('techno'); | |
$('#technos nav ul li').removeClass('active'); | |
$(this).addClass('active'); | |
var gamme; | |
if($(this).hasClass('g-n2')){ | |
gamme = 'n2'; | |
} | |
if($(this).hasClass('g-n3')){ | |
gamme = 'n3'; | |
} | |
if(techno == 'geo') | |
{ | |
$('#productlist nav ul li').removeClass('active'); | |
$('#productlist nav ul li:first-child').addClass('active'); | |
$('.product-desc').fadeOut(0); | |
$('.coupe .vue').fadeOut(0); | |
$('.carac').fadeOut(0); | |
$('.remarque').fadeOut(0); | |
if(gamme == 'n2'){ | |
$('#productlist nav.pdts-gamme-n3').fadeOut(300); | |
$('#productlist nav.pdts-gamme-n2.geo').fadeIn(300); | |
$('#productlist nav.pdts-gamme-n2.aqua').fadeOut(300); | |
$('.product-1').fadeIn(0); | |
$('.coupe .coupe-1').fadeIn(0); | |
$('.carac-product-1').fadeIn(300); | |
$('.remarque-1').fadeIn(300); | |
} else if(gamme == 'n3'){ | |
$('#productlist nav.pdts-gamme-n2').fadeOut(300); | |
$('#productlist nav.pdts-gamme-n3.geo').fadeIn(300); | |
$('#productlist nav.pdts-gamme-n3.aqua').fadeOut(300); | |
$('.product-7').fadeIn(0); | |
$('.coupe .coupe-7').fadeIn(0); | |
$('.carac-product-7').fadeIn(300); | |
$('.remarque-7').fadeIn(300); | |
} | |
$('.infos h4').fadeIn(300); | |
$('.coupe h4').fadeIn(300); | |
} | |
else if(techno == 'aqua') | |
{ | |
$('#productlist nav ul li').removeClass('active'); | |
$('#productlist nav ul li:first-child').addClass('active'); | |
$('.coupe .vue').fadeOut(300); | |
$('.product-desc').fadeOut(300); | |
$('.carac').fadeOut(300); | |
$('.remarque').fadeOut(300); | |
if(gamme == 'n2'){ | |
$('#productlist nav.pdts-gamme-n2.geo').fadeOut(300); | |
$('#productlist nav.pdts-gamme-n2.aqua').fadeIn(300); | |
$('.coupe .coupe-4').fadeIn(300); | |
$('.product-4').fadeIn(300); | |
$('.carac-product-4').fadeIn(300); | |
$('.remarque-4').fadeIn(300); | |
} else if(gamme == 'n3'){ | |
$('#productlist nav.pdts-gamme-n3.geo').fadeOut(300); | |
$('#productlist nav.pdts-gamme-n3.aqua').fadeIn(300); | |
$('.coupe .coupe-10').fadeIn(300); | |
$('.product-10').fadeIn(300); | |
$('.carac-product-10').fadeIn(300); | |
$('.remarque-10').fadeIn(300); | |
} | |
$('.infos h4').fadeIn(300); | |
$('.coupe h4').fadeIn(300); | |
} | |
}); | |
// productlist | |
$('#productlist nav ul li').on('click', function(){ | |
var productId = $(this).data('product-id'); | |
$('#productlist nav ul li').removeClass('active'); | |
$(this).addClass('active'); | |
$('.coupe .vue').fadeOut(300); | |
$('.coupe .coupe-'+productId).fadeIn(300); | |
$('.product-desc').fadeOut(0); | |
$('.product-'+productId).fadeIn(0); | |
$('.carac').fadeOut(300); | |
$('.carac-product-'+productId).fadeIn(300); | |
$('.remarque').fadeOut(300); | |
$('.remarque-'+productId).fadeIn(300); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment