Commit 76e735c6 authored by Nahla Shiri's avatar Nahla Shiri

menu fixe

parent 4ac0e8a6
var initFunction=function(){
var initFunction = function() {
};//END init Function
(function($) {
$(function(){
//Stop jump tag
$(document).find('a[href^="#"], .easyzoom a').click(function(e){
e.preventDefault();
});
$(document).find('.contact-form .open-filter').on('click', function(){
$('.contact-form form').slideToggle();
$(this).parent().toggleClass('on');
checkFilterContactWrapper();
})
//Open Menu
var toggles = document.querySelectorAll(".c-hamburger");
for (var i = toggles.length - 1; i >= 0; i--) {
var toggle = toggles[i];
toggleHandler(toggle);
};
function toggleHandler(toggle) {
toggle.addEventListener( "click", function(e) {
var nav = $('.main-nav .nav-content');
//(this.classList.contains("is-active") === true) ? this.classList.remove("is-active") : this.classList.add("is-active");
$(".c-hamburger").toggleClass('is-active');
if ($(".c-hamburger").hasClass('is-active')) { //Open menu
nav.removeClass('OFF').addClass("ON");
nav.parent().addClass("show-nav transition");
$('body').addClass('fixed');
if (!($('.main-nav .nav-content .footer').length)){
$('.main-nav .nav-content').append($('footer .footer').clone(true,true));
}
$('.right-panel-wrapper').css('z-index','9999');
}
else { //Close menu
nav.removeClass('ON').addClass("OFF");
$('body').removeClass('fixed');
nav.parent().removeClass("show-nav");
$('.main-nav .nav-content .footer').remove();
setTimeout(function(){
$('.right-panel-wrapper').css('z-index','9999999');
},500)
}
setTimeout(function(){
checkFooterNavPosition();
},330)
nav.stop().slideToggle();
});
}
$.fn.loadPageContent = function(){
if ($('body').find('header').length > 1){
$('body').find('header').last().parent().remove();
$('.right-panel-wrapper').css('top', $('.nav-header').outerHeight());
$('html').css('overflow','auto');
}
//$('.load-page').removeClass('fadeOutUp').addClass('animated fadeInUp')
$('ul.phototheque').find('li').first().addClass('current');
$('ul.phototheque').find('li').first().find('.subcat').slideDown('slow');
var product = $('.list-animation article');
// TODO: Remove init classes , init attr on html
product.find('figure img,ul,h3,.new,.download-btn').attr( { 'data-animate':"", 'data-animation-classes':"animated fadeIn" } );
animateOnScroll();
if ($(document).find('#load-page').children().length){
scrollAnchor("#load-page", true);
elemToScroll = $(document).find("#load-page");
}else{
elemToScroll = $(document).find(".main");
scrollAnchor('body', true);
}
elemToScroll.on("scroll",onScroll);
document.getElementById('load-page').addEventListener('scroll', window.scrollAnimation.throttledEvent, false);
$(document).find('ul.main-list-nav').on('click',' li.parent-cat>a',function(e){
var windowWidth = $(window).width();
e.preventDefault();
e.stopPropagation();
$('.main-list-nav>li').removeClass('current');
$(this).parent().addClass('current');
//if (windowWidth < 860){
//$('.nav-phototeque .nav-content>ul>li').addClass('animated fadeOutLeft');
//$('.nav-phototeque .nav-content li.current').removeClass('fadeOutLeft').addClass('fadeInRight');
//$('.nav-phototeque .nav-content li.current ul').removeClass('fadeOutLeft').addClass('fadeInRight');
//$('.nav-phototeque .nav-content li.current ul').css('display','inline-block !important');
//.phototheque-content nav li
//}else{
$('.main-list-nav .subcat').stop().slideUp('slow');
// $('.main-list-nav .off .subcat').slideUp();
$(this).parent().find('.subcat').stop().slideDown('slow');
//}
});
setTimeout(function(){
$('.gallery-wrapper').removeClass('hidden-elem').addClass('animated visible-elem fadeInUp');
$.fn.responsive();
},100);
}
function appendLoading() {
$('.load-page').append($('#loading-container-subpage').clone());
$('#loading-container-subpage').show();
}
//load content page on left Panel
$(document).find('.to-slide').on('click','a',function(e){
$('html').css('overflow','hidden');
appendLoading();
e.preventDefault();
var link = $(this).attr("href"),
windowWidth = $(window).width();
if ($(this).parent().parent().hasClass('nav-page')){
$(document).find('.right-container').first().remove();
$('.load-page').parent().css({
'left':$('.nav-wrapper').outerWidth()
$(function() {
//Stop jump tag
$(document).find('a[href^="#"], .easyzoom a').click(function(e) {
e.preventDefault();
});
$(document).find('.contact-form .open-filter').on('click', function() {
$('.contact-form form').slideToggle();
$(this).parent().toggleClass('on');
checkFilterContactWrapper();
})
//Open Menu
var toggles = document.querySelectorAll(".c-hamburger");
for (var i = toggles.length - 1; i >= 0; i--) {
var toggle = toggles[i];
toggleHandler(toggle);
}
;
function toggleHandler(toggle) {
toggle.addEventListener("click", function(e) {
var nav = $('.main-nav .nav-content');
//(this.classList.contains("is-active") === true) ? this.classList.remove("is-active") : this.classList.add("is-active");
$(".c-hamburger").toggleClass('is-active');
if ($(".c-hamburger").hasClass('is-active')) { //Open menu
nav.removeClass('OFF').addClass("ON");
nav.parent().addClass("show-nav transition");
$('body').addClass('fixed');
if (!($('.main-nav .nav-content .footer').length)) {
$('.main-nav .nav-content').append($('footer .footer').clone(true, true));
}
$('.right-panel-wrapper').css('z-index', '9999');
}
else { //Close menu
nav.removeClass('ON').addClass("OFF");
$('body').removeClass('fixed');
nav.parent().removeClass("show-nav");
$('.main-nav .nav-content .footer').remove();
setTimeout(function() {
$('.right-panel-wrapper').css('z-index', '9999999');
}, 500)
}
setTimeout(function() {
checkFooterNavPosition();
}, 330)
nav.stop().slideToggle();
});
$('.load-page').css('opacity',1);
$(document).find('#loading-container-subpage').css({
'left': $('.nav-wrapper').outerWidth(),
'width': 'calc(100% - ' + $('.nav-wrapper').outerWidth()+'px)',
})
/**/
$('nav ul li').removeClass('current').addClass('off');
$(this).parent().addClass('current');
$(window)
/**/
}else{
$('.load-page').parent().css({
'left':0,
});
$('.load-page').parent().addClass('active');
}
history.pushState(null, null, link);
$('.load-page').load(link,{'ajax' : 1},function(){
$.fn.loadPageContent();
});
if (windowWidth < 860){
$( ".c-hamburger" ).trigger( "click" );
}
});
var div = $('.nav-content');
$('.footer-home-content').on('click','.home-down:not(.scrolled)',function(e){
TweenMax.killTweensOf('.nav-content');
var mainHeight = $('.main').outerHeight();
$(this).addClass('scrolled');
if (!($('.footer-home-content .nav-content').length)){
$('.footer-home-content').append($('.nav-content').clone());
$('.main').outerHeight(mainHeight + $('.footer-home-content').outerHeight());
$('.home-down-wrapper').css('top', - ($('.home-down-wrapper').outerHeight()));
$('.home-down').css('top', -($('.home-down').outerHeight()));
//$('.home-down-wrapper').css('top','121px');
}
//scroll to bottom
$('body').animate({
scrollTop: div.outerHeight()
}, 1000,'swing',function(){
});
}).on('click','.scrolled',function(){
$(this).removeClass('scrolled');
$("html, body").animate({ scrollTop: 0 }, "slow");
setTimeout(function(){
$('.footer-home-content').find('.nav-content').remove();
$('.home-down-wrapper').css('top','initial');
$('.footer-home-content').removeClass('fixed');
$('.main').height($(window).innerHeight());
},600)
return false;
});
}
$.fn.loadPageContent = function() {
if ($('body').find('header').length > 1) {
$('body').find('header').last().parent().remove();
$('.right-panel-wrapper').css('top', $('.nav-header').outerHeight());
$('html').css('overflow', 'auto');
}
//$('.load-page').removeClass('fadeOutUp').addClass('animated fadeInUp')
$('ul.phototheque').find('li').first().addClass('current');
$('ul.phototheque').find('li').first().find('.subcat').slideDown('slow');
var product = $('.list-animation article');
// TODO: Remove init classes , init attr on html
product.find('figure img,ul,h3,.new,.download-btn').attr({'data-animate': "", 'data-animation-classes': "animated fadeIn"});
animateOnScroll();
if ($(document).find('#load-page').children().length) {
scrollAnchor("#load-page", true);
elemToScroll = $(document).find("#load-page");
} else {
elemToScroll = $(document).find(".main");
scrollAnchor('body', true);
}
elemToScroll.on("scroll", onScroll);
document.getElementById('load-page').addEventListener('scroll', window.scrollAnimation.throttledEvent, false);
$(document).find('ul.main-list-nav').on('click', ' li.parent-cat>a', function(e) {
var windowWidth = $(window).width();
e.preventDefault();
e.stopPropagation();
$('.main-list-nav>li').removeClass('current');
$(this).parent().addClass('current');
//if (windowWidth < 860){
//$('.nav-phototeque .nav-content>ul>li').addClass('animated fadeOutLeft');
//$('.nav-phototeque .nav-content li.current').removeClass('fadeOutLeft').addClass('fadeInRight');
//$('.nav-phototeque .nav-content li.current ul').removeClass('fadeOutLeft').addClass('fadeInRight');
//$('.nav-phototeque .nav-content li.current ul').css('display','inline-block !important');
//.phototheque-content nav li
//}else{
$('.main-list-nav .subcat').stop().slideUp('slow');
// $('.main-list-nav .off .subcat').slideUp();
$(this).parent().find('.subcat').stop().slideDown('slow');
//}
});
setTimeout(function() {
$('.gallery-wrapper').removeClass('hidden-elem').addClass('animated visible-elem fadeInUp');
$.fn.responsive();
}, 100);
}
function appendLoading() {
$('.load-page').append($('#loading-container-subpage').clone());
$('#loading-container-subpage').show();
}
//load content page on left Panel
$(document).find('.to-slide').on('click', 'a', function(e) {
$('html').css('overflow', 'hidden');
appendLoading();
e.preventDefault();
var link = $(this).attr("href"),
windowWidth = $(window).width();
if ($(this).parent().parent().hasClass('nav-page')) {
$(document).find('.right-container').first().remove();
$('.load-page').parent().css({
'left': $('.nav-wrapper').outerWidth()
});
$('.load-page').css('opacity', 1);
$(document).find('#loading-container-subpage').css({
'left': $('.nav-wrapper').outerWidth(),
'width': 'calc(100% - ' + $('.nav-wrapper').outerWidth() + 'px)',
})
/**/
$('nav ul li').removeClass('current').addClass('off');
$(this).parent().addClass('current');
/**/
} else {
$('.load-page').parent().css({
'left': 0,
});
$('.load-page').parent().addClass('active');
}
history.pushState(null, null, link);
$('.load-page').load(link, {'ajax': 1}, function() {
$.fn.loadPageContent();
$.fn.responsive();
$.fn.animation();
});
if (windowWidth < 860) {
$(".c-hamburger").trigger("click");
}
});
var div = $('.nav-content');
$('.footer-home-content').on('click', '.home-down:not(.scrolled)', function(e) {
TweenMax.killTweensOf('.nav-content');
var mainHeight = $('.main').outerHeight();
$(this).addClass('scrolled');
if (!($('.footer-home-content .nav-content').length)) {
$('.footer-home-content').append($('.nav-content').clone());
$('.main').outerHeight(mainHeight + $('.footer-home-content').outerHeight());
$('.home-down-wrapper').css('top', -($('.home-down-wrapper').outerHeight()));
$('.home-down').css('top', -($('.home-down').outerHeight()));
//$('.home-down-wrapper').css('top','121px');
}
//scroll to bottom
$('body').animate({
scrollTop: div.outerHeight()
}, 1000, 'swing', function() {
});
}).on('click', '.scrolled', function() {
$(this).removeClass('scrolled');
$("html, body").animate({scrollTop: 0}, "slow");
setTimeout(function() {
$('.footer-home-content').find('.nav-content').remove();
$('.home-down-wrapper').css('top', 'initial');
$('.footer-home-content').removeClass('fixed');
$('.main').height($(window).innerHeight());
}, 600)
return false;
});
//Get file name of uploaded file
$('#file-p').on('change',function(e){
var fileName = e.target.files[0].name;
$('.upload-btn').after($('<p class="loaded-file">' + fileName + '</p>'));
})
$('#file-p').on('change', function(e) {
var fileName = e.target.files[0].name;
$('.upload-btn').after($('<p class="loaded-file">' + fileName + '</p>'));
})
//END get file name
//END load content page on left Panel
$(document).on('click','.int-link',function(e){
e.preventDefault();
$('.load-page').parent().removeClass('active');
$('.load-page').parent().css('left','100%');
history.pushState(null, null, $(this).find('a').attr('href'));
$('html').css('overflow','auto');
tlProduct.reverse();
//$('.load-page').removeClass('fadeInUp').addClass('animated fadeOutUp');
});
$(document).on('click','.acces li .login, .login-user',function(e){
e.stopImmediatePropagation();
var windowWidth = $(window).width();
$('.popup-container').fadeIn();
if (windowWidth < 860){
$( ".c-hamburger" ).trigger( "click" );
}
// $('#user_login').attr('placeholder', 'Identifiant');
// $('#user_pass').attr('placeholder', 'Mot de passe');
$('.popup-first').removeClass('fadeOutDown ').addClass('animated visible-elem pulse');
});
$(document).on('click', '.int-link', function(e) {
e.preventDefault();
$('.load-page').parent().removeClass('active');
$('.load-page').parent().css('left', '100%');
history.pushState(null, null, $(this).find('a').attr('href'));
$('html').css('overflow', 'auto');
tlProduct.reverse();
//$('.load-page').removeClass('fadeInUp').addClass('animated fadeOutUp');
});
$(document).on('click', '.acces li .login, .login-user', function(e) {
e.stopImmediatePropagation();
var windowWidth = $(window).width();
$('.popup-container').fadeIn();
if (windowWidth < 860) {
$(".c-hamburger").trigger("click");
}
// $('#user_login').attr('placeholder', 'Identifiant');
// $('#user_pass').attr('placeholder', 'Mot de passe');
$('.popup-first').removeClass('fadeOutDown ').addClass('animated visible-elem pulse');
});
//Close popup
$('.popup-first .close-btn').click(
function(){
$('.popup-first').removeClass('visible-elem pulse').addClass('fadeOutDown');
setTimeout(function(){
$('.popup-container').fadeOut('slow');
},0);
});
checkWhiteColor = function(color) {
var white = ["#fff","#ffffff","white" ];
if ($.inArray(color, white) != -1){
color = '#999999';
}
return color;
}
$('.popup-first .close-btn').click(
function() {
$('.popup-first').removeClass('visible-elem pulse').addClass('fadeOutDown');
setTimeout(function() {
$('.popup-container').fadeOut('slow');
}, 0);
});
checkWhiteColor = function(color) {
var white = ["#fff", "#ffffff", "white"];
if ($.inArray(color, white) != -1) {
color = '#999999';
}
return color;
}
//checkWhiteColor = function(item) {
$.fn.setColorToWhite = function(item){
//$('.list-wrapper .color-list')
$(this).each(function(){
elem = item ? $(this).find(item) : $(this),
isWhite = checkWhiteColor(elem.data('color'));
if(isWhite != elem.data('color')){
elem.addClass('is-white');
}
});
}
$.fn.setBgColorList = function(){
$(this).each(function(){
$(this).css({
'background-color' : $(this).data('color'),
'border' : '1px solid' + checkWhiteColor($(this).data('color'))
})
})
}
$.fn.showProductListColors = function(){
var articleWrapper = $(this),
firstPellet = articleWrapper.find('li').first(),
articleColor = checkWhiteColor(firstPellet.data('color'));
articleLink = firstPellet.data('link');
articleWrapper.find('.article-bg').css('background-color',articleColor);
articleWrapper.find('figure img').attr({
'src' : firstPellet.data('image'),
'data-link' : articleLink
});
$('.product-list article ul li').setBgColorList();
}
$.fn.setColorToWhite = function(item) {
//$('.list-wrapper .color-list')
$(this).each(function() {
elem = item ? $(this).find(item) : $(this),
isWhite = checkWhiteColor(elem.data('color'));
if (isWhite != elem.data('color')) {
elem.addClass('is-white');
}
});
}
$.fn.setBgColorList = function() {
$(this).each(function() {
$(this).css({
'background-color': $(this).data('color'),
'border': '1px solid' + checkWhiteColor($(this).data('color'))
})
})
}
$.fn.showProductListColors = function() {
var articleWrapper = $(this),
firstPellet = articleWrapper.find('li').first(),
articleColor = checkWhiteColor(firstPellet.data('color'));
articleLink = firstPellet.data('link');
articleWrapper.find('.article-bg').css('background-color', articleColor);
articleWrapper.find('figure img').attr({
'src': firstPellet.data('image'),
'data-link': articleLink
});
$('.product-list article ul li').setBgColorList();
}
//FadeIn Image on home page
$.fn.fadeImage= function(){
var srcImage = $(this).data('img');
if (srcImage == 'undefined' || !srcImage)
{
srcImage = $('#home .img-wrapper').data('defaultimg');
}
$('.img-wrapper').removeClass('animate');
$('.img-wrapper').stop().animate({
opacity:0,
}, 500, function() {});
$('.img-wrapper').stop().animate({
opacity:1,
},500, function() {
$('.img-wrapper').addClass('animate');
$('.img-wrapper').css({
'background-image': "url("+ srcImage +")",
});
});
}
$.fn.showSubmenu = function(){
var currentPage = $('.container').data('page');
$('header nav').find('ul li').find("[data-page="+currentPage+"]").slideDown();
$('header nav').find('ul').find("[data-page="+currentPage+"]").addClass('current');
}
$.fn.fadeImage = function() {
var srcImage = $(this).data('img');
if (srcImage == 'undefined' || !srcImage)
{
srcImage = $('#home .img-wrapper').data('defaultimg');
}
$('.img-wrapper').removeClass('animate');
$('.img-wrapper').stop().animate({
opacity: 0,
}, 500, function() {
});
$('.img-wrapper').stop().animate({
opacity: 1,
}, 500, function() {
$('.img-wrapper').addClass('animate');
$('.img-wrapper').css({
'background-image': "url(" + srcImage + ")",
});
});
}
$.fn.showSubmenu = function() {
var currentPage = $('.container').data('page');
$('header nav').find('ul li').find("[data-page=" + currentPage + "]").slideDown();
$('header nav').find('ul').find("[data-page=" + currentPage + "]").addClass('current');
}
//animate menu nav
$.fn.open_nav = function(){
TweenLite.set(".nav-content", {visibility : "visible"});
var tl = new TimelineMax();
tl.staggerFrom('.nav-content >ul>li, .phototheque-content nav >ul > li',0.5,{opacity:0,x:200},0.1,0.5);
tl.staggerFromTo('nav ul ul li ',0.5,{opacity:0,x:200},{opacity:1,x:0},0.1,1.2);
tl.fromTo('.news-btn',0.9,{autoAlpha:0,scale:'0'},{autoAlpha:1,scale:'1'},0);
}
$.fn.openPanelAnimation = function(){
$(this).addClass('animated slideInRight').removeClass('slideOutRight').show();
}
$.fn.closePanelAnimation = function(){
$(this).removeClass('slideInRight').addClass('slideOutRight');
}
$.fn.open_news = function(){
$(this).on('click',function(){
$('.news-wrapper').openPanelAnimation();
})
}
$.fn.close_news = function(){
$(this).on('click',function(){
$('.news-wrapper').closePanelAnimation();
})
}
$.fn.reinitFilter = function(){
$(this).removeClass('selected-filter selected');
}
$.fn.open_filter = function(){
$(this).on('click','.filter-btn',function(){
var filterW = $('.filter-list').outerWidth(),
mainW = $('.main-nav').outerWidth(),
filterBtn = $('.filter-btn .btn-container').outerWidth();
tlFilter = new TimelineMax();
tlFilter.staggerFromTo('.filter-bloc',0.5,{opacity:0,y:100},{opacity:1,y:0},0.1,0);
tlFilter.fromTo('.filter-list',0.5,{opacity:0,left:'0',visibility:"hidden"},{opacity:1,left:mainW,visibility:"visible"},0);
tlFilter.to('.filter-btn .btn-container',0.5,{opacity:0,left:filterW, width:"0px"},0);
//tl.fromTo('#slides',0.5,{opacity:1},{opacity:0},0);
//tl.fromTo('.nav-slider',0.5,{opacity:1},{opacity:0},0);
}).on('click','.close-btn',function(){
tlFilter.reverse();
}).on('click','.filter-bloc .header',function(){
var $this = $(this).parent();
if (!$this.hasClass('active')){
$('.filter-bloc').removeClass('active');
$this.addClass('active');
$('.filter-bloc .bloc-content').slideUp('slow');
$this.find('.bloc-content').slideDown('slow');
$('.commercial').slideUp('slow');
}else{
$this.removeClass('active');
$this.find('.bloc-content').slideUp('slow');
}
}).on('click','.filter-bloc li:not(.disabled,.reinit)',function(e){
e.stopPropagation();
$(this).toggleClass('selected');
var e = $(this).parent().find('.selected').length,
parentFilter = $(this).parent().parent().parent();
if (e){
parentFilter.addClass('selected-filter');
$('.filter-btn').addClass('selected-filter');
}else{
parentFilter.removeClass('selected-filter') ;
$('.filter-btn').removeClass('selected-filter');
}
//e ? parentFilter.addClass('selected-filter') : parentFilter.removeClass('selected-filter') ;
}).on('click','.filter-bloc .reinit',function(){
selector = $(this).parent().parent();
selector.parent().reinitFilter();
selector.find('li').reinitFilter();
}).on('click','.reinit-all',function(){
$('.filter-bloc , .filter-bloc li').reinitFilter();
$('.filter-btn').removeClass('selected-filter');
});
}
$.fn.checkSelectedFilter = function(){
if ($('.filter-content .filter-bloc.selected-filter').length){
$('.filter-btn').addClass('selected-filter');
}
}
$.fn.changeProductImageBg = function(){
var
selectedColor = checkWhiteColor($(this).data("color")),
selectedImage = $(this).data("image"),
linkProduct = $(this).data("link"),
tl = new TimelineMax(),
container = $(this).parent().parent();
container.find('.article-bg').css({"background-color": selectedColor, opacity:'0.1'});
container.find('img').attr({'src' : selectedImage , 'data-link' : linkProduct});
tl.fromTo(container.find('img'),1,{opacity:0,visibility:"hidden"},{opacity:1,visibility:"visible"},0);
}
$.fn.animatePageScroll = function(element, duration) {
return $(this).fromTo(element,duration,
{opacity:0,visibility:"hidden",marginBottom:'80px'},
{opacity:1,visibility:"visible",marginBottom:'0px'},0.7);
}
$.fn.fullpageSlide = function(){
var
timeout = 1.7,
duration = 1.2;
setTimeout(function(){
$('.moveDown').removeClass('hidden-elem').addClass('visible-elem animated rollIn');
}, 2000);
$("#fullpage .section").first().addClass('first');
$(this).fullpage({
verticalCentered: false,
css3:false,
scrollingSpeed: 1500,
lazyLoading: false ,
fixedElements: 'footer',
controlArrows: true,
fitToSectionDelay: 800000,
fadingEffect: true,
normalScrollElements : ".section .bloc",
afterLoad: function(anchor, index){
tl1 = new TimelineMax();
var firstSection = $("#fullpage .section.first");
$.fn.open_nav = function() {
TweenLite.set(".nav-content", {visibility: "visible"});
var tl = new TimelineMax();
tl.staggerFrom('.nav-content >ul>li, .phototheque-content nav >ul > li', 0.5, {opacity: 0, x: 200}, 0.1, 0.5);
tl.staggerFromTo('nav ul ul li ', 0.5, {opacity: 0, x: 200}, {opacity: 1, x: 0}, 0.1, 1.2);
tl.fromTo('.news-btn', 0.9, {autoAlpha: 0, scale: '0'}, {autoAlpha: 1, scale: '1'}, 0);
}
$.fn.openPanelAnimation = function() {
$(this).addClass('animated slideInRight').removeClass('slideOutRight').show();
}
$.fn.closePanelAnimation = function() {
$(this).removeClass('slideInRight').addClass('slideOutRight');
}
$.fn.open_news = function() {
$(this).on('click', function() {
$('.news-wrapper').openPanelAnimation();
})
}
$.fn.close_news = function() {
$(this).on('click', function() {
$('.news-wrapper').closePanelAnimation();
})
}
$.fn.reinitFilter = function() {
$(this).removeClass('selected-filter selected');
}
$.fn.open_filter = function() {
$(this).on('click', '.filter-btn', function() {
var filterW = $('.filter-list').outerWidth(),
mainW = $('.main-nav').outerWidth(),
filterBtn = $('.filter-btn .btn-container').outerWidth();
tlFilter = new TimelineMax();
tlFilter.staggerFromTo('.filter-bloc', 0.5, {opacity: 0, y: 100}, {opacity: 1, y: 0}, 0.1, 0);
tlFilter.fromTo('.filter-list', 0.5, {opacity: 0, left: '0', visibility: "hidden"}, {opacity: 1, left: mainW, visibility: "visible"}, 0);
tlFilter.to('.filter-btn .btn-container', 0.5, {opacity: 0, left: filterW, width: "0px"}, 0);
//tl.fromTo('#slides',0.5,{opacity:1},{opacity:0},0);
//tl.fromTo('.nav-slider',0.5,{opacity:1},{opacity:0},0);
}).on('click', '.close-btn', function() {
tlFilter.reverse();
}).on('click', '.filter-bloc .header', function() {
var $this = $(this).parent();
if (!$this.hasClass('active')) {
$('.filter-bloc').removeClass('active');
$this.addClass('active');
$('.filter-bloc .bloc-content').slideUp('slow');
$this.find('.bloc-content').slideDown('slow');
$('.commercial').slideUp('slow');
} else {
$this.removeClass('active');
$this.find('.bloc-content').slideUp('slow');
}
}).on('click', '.filter-bloc li:not(.disabled,.reinit)', function(e) {
e.stopPropagation();
$(this).toggleClass('selected');
var e = $(this).parent().find('.selected').length,
parentFilter = $(this).parent().parent().parent();
if (e) {
parentFilter.addClass('selected-filter');
$('.filter-btn').addClass('selected-filter');
} else {
parentFilter.removeClass('selected-filter');
$('.filter-btn').removeClass('selected-filter');
}
//e ? parentFilter.addClass('selected-filter') : parentFilter.removeClass('selected-filter') ;
}).on('click', '.filter-bloc .reinit', function() {
selector = $(this).parent().parent();
selector.parent().reinitFilter();
selector.find('li').reinitFilter();
}).on('click', '.reinit-all', function() {
$('.filter-bloc , .filter-bloc li').reinitFilter();
$('.filter-btn').removeClass('selected-filter');
});
}
$.fn.checkSelectedFilter = function() {
if ($('.filter-content .filter-bloc.selected-filter').length) {
$('.filter-btn').addClass('selected-filter');
}
}
$.fn.changeProductImageBg = function() {
var
selectedColor = checkWhiteColor($(this).data("color")),
selectedImage = $(this).data("image"),
linkProduct = $(this).data("link"),
tl = new TimelineMax(),
container = $(this).parent().parent();
container.find('.article-bg').css({"background-color": selectedColor, opacity: '0.1'});
container.find('img').attr({'src': selectedImage, 'data-link': linkProduct});
tl.fromTo(container.find('img'), 1, {opacity: 0, visibility: "hidden"}, {opacity: 1, visibility: "visible"}, 0);
}
$.fn.animatePageScroll = function(element, duration) {
return $(this).fromTo(element, duration,
{opacity: 0, visibility: "hidden", marginBottom: '80px'},
{opacity: 1, visibility: "visible", marginBottom: '0px'}, 0.7);
}
$.fn.fullpageSlide = function() {
var
timeout = 1.7,
duration = 1.2;
setTimeout(function() {
$('.moveDown').removeClass('hidden-elem').addClass('visible-elem animated rollIn');
}, 2000);
$("#fullpage .section").first().addClass('first');
$(this).fullpage({
verticalCentered: false,
css3: false,
scrollingSpeed: 1500,
lazyLoading: false,
fixedElements: 'footer',
controlArrows: true,
fitToSectionDelay: 800000,
fadingEffect: true,
normalScrollElements: ".section .bloc",
afterLoad: function(anchor, index) {
tl1 = new TimelineMax();
var firstSection = $("#fullpage .section.first");
//tl1.animatePageScroll(firstSection,duration);
//console.log(animation);
tl1.fromTo(firstSection.find('.bloc .header-bloc'),1.5,
{opacity:0,visibility:"hidden",marginBottom:'80px'},
{opacity:1,visibility:"visible",marginBottom:'0px'},timeout);
tl1.fromTo(firstSection.find('.bloc .desc-content'),1,
{opacity:0,visibility:"hidden",marginLeft:'-100px'},
{opacity:1,visibility:"visible",marginLeft:'0px'},timeout);
},
onLeave: function(index, nextIndex, direction){
var
activeSection = $(this),
nextSection = $(this).next();
tl2 = new TimelineMax();
timeout = 0.7;
activeSection.removeClass('first');
if ( nextIndex === $('#fullpage .section').length){
$('.moveDown').removeClass('hidden-elem').addClass('visible-elem animated rollOut');
}else {
$('.moveDown').removeClass('rollOut');
}
tl2.fromTo(nextSection.find('.bloc .header-bloc'),1.5,
{opacity:0,visibility:"hidden",marginBottom:'80px'},
{opacity:1,visibility:"visible",marginBottom:'0px'},timeout);
tl2.fromTo(nextSection.find('.bloc .desc-content'),1,
{opacity:0,visibility:"hidden",marginLeft:'-100px'},
{opacity:1,visibility:"visible",marginLeft:'0px'},timeout);
if (direction === 'up') {
tl3 = new TimelineMax();
prevSection = $(this).prev();
tl3.fromTo(prevSection.find('.bloc .header-bloc'),1.5,
{opacity:0,visibility:"hidden",marginBottom:'80px'},
{opacity:1,visibility:"visible",marginBottom:'0px'},timeout);
tl3.fromTo(prevSection.find('.bloc .desc-content'),1,
{opacity:0,visibility:"hidden",marginLeft:'-100px'},
{opacity:1,visibility:"visible",marginLeft:'0px'},timeout);
}
},
});
$(document).on('click', '.moveDown', function(){
$.fn.fullpage.moveSectionDown();
});
}
$.fn.getMenuBg = function(){
var imgSrc = $('header .nav-content > ul').find(' > li.current').data('img'),
windowWidth = $(window).width(),
navwWidth = $('.nav-wrapper').width(),
navHeight = $('.nav-header').outerHeight();
$('.container-bg').css({
'background-image': "url("+ imgSrc +")",
'opacity' : 0,
})
tlBg = new TimelineMax();
tlBg.to('.container-bg',0.9,{opacity:1},0.5);
tlBg.from('.full-slides',1.2,{opacity:0, width:0},0.4);
if (windowWidth > 860){
tlBg.to('.container-bg',1.2,{width:navwWidth},0.4);
}
}
$.fn.appendMap = function(){
var $this = $(this);
if (!(this.find('.map').length)){
this.append($('.map'));
}
setTimeout(function(){
initMap();
},330)
}
$.fn.appendMobileMenu = function(){
var $this = $(this);
setTimeout(function(){
if (!($this.find('li.current').length)){
$('.main-nav .nav-content li.current').addClass('to-replace');
$('.main-nav .nav-content li.current').clone(true).find('ul').remove().end().appendTo($this);
$this.find("li.current").append($('.main-nav.nav-wrapper li.current ul'));
}
$('.right-container').css('padding-top',$this.parent().outerHeight());
},2000)
}
tl1.fromTo(firstSection.find('.bloc .header-bloc'), 1.5,
{opacity: 0, visibility: "hidden", marginBottom: '80px'},
{opacity: 1, visibility: "visible", marginBottom: '0px'}, timeout);
tl1.fromTo(firstSection.find('.bloc .desc-content'), 1,
{opacity: 0, visibility: "hidden", marginLeft: '-100px'},
{opacity: 1, visibility: "visible", marginLeft: '0px'}, timeout);
},
onLeave: function(index, nextIndex, direction) {
var
activeSection = $(this),
nextSection = $(this).next();
tl2 = new TimelineMax();
timeout = 0.7;
activeSection.removeClass('first');
if (nextIndex === $('#fullpage .section').length) {
$('.moveDown').removeClass('hidden-elem').addClass('visible-elem animated rollOut');
} else {
$('.moveDown').removeClass('rollOut');
}
tl2.fromTo(nextSection.find('.bloc .header-bloc'), 1.5,
{opacity: 0, visibility: "hidden", marginBottom: '80px'},
{opacity: 1, visibility: "visible", marginBottom: '0px'}, timeout);
tl2.fromTo(nextSection.find('.bloc .desc-content'), 1,
{opacity: 0, visibility: "hidden", marginLeft: '-100px'},
{opacity: 1, visibility: "visible", marginLeft: '0px'}, timeout);
if (direction === 'up') {
tl3 = new TimelineMax();
prevSection = $(this).prev();
tl3.fromTo(prevSection.find('.bloc .header-bloc'), 1.5,
{opacity: 0, visibility: "hidden", marginBottom: '80px'},
{opacity: 1, visibility: "visible", marginBottom: '0px'}, timeout);
tl3.fromTo(prevSection.find('.bloc .desc-content'), 1,
{opacity: 0, visibility: "hidden", marginLeft: '-100px'},
{opacity: 1, visibility: "visible", marginLeft: '0px'}, timeout);
}
},
});
$(document).on('click', '.moveDown', function() {
$.fn.fullpage.moveSectionDown();
});
}
$.fn.getMenuBg = function() {
var imgSrc = $('header .nav-content > ul').find(' > li.current').data('img'),
windowWidth = $(window).width(),
navwWidth = $('.nav-wrapper').width(),
navHeight = $('.nav-header').outerHeight();
$('.container-bg').css({
'background-image': "url(" + imgSrc + ")",
'opacity': 0,
})
tlBg = new TimelineMax();
tlBg.to('.container-bg', 0.9, {opacity: 1}, 0.5);
tlBg.from('.full-slides', 1.2, {opacity: 0, width: 0}, 0.4);
if (windowWidth > 860) {
tlBg.to('.container-bg', 1.2, {width: navwWidth}, 0.4);
}
}
$.fn.appendMap = function() {
var $this = $(this);
if (!(this.find('.map').length)) {
this.append($('.map'));
}
setTimeout(function() {
initMap();
}, 330)
}
$.fn.appendMobileMenu = function() {
var $this = $(this);
setTimeout(function() {
if (!($this.find('li.current').length)) {
$('.main-nav .nav-content li.current').addClass('to-replace');
$('.main-nav .nav-content li.current').clone(true).find('ul').remove().end().appendTo($this);
$this.find("li.current").append($('.main-nav.nav-wrapper li.current ul'));
}
$('.right-container').css('padding-top', $this.parent().outerHeight());
}, 2000)
}
//Responsive function
$.fn.responsive = function(){
$(".product-details").css('height','auto');
var footerHeight = $('footer').height(),
productHeight = $(".product-details").outerHeight(),
productWidth = $(".product-details").outerWidth(),
windowHeight = $(window).innerHeight(),
windowWidth = $(window).width(),
navMenuWidth = $('.nav-wrapper').outerWidth(),
navHeight = $('.nav-header').outerHeight(),
navHeader = $('.nav-header').outerHeight(),
containerHeight = windowHeight - footerHeight ,
navPhototequeWidth = $('.nav-phototeque').outerWidth(),
navPhototequeHeight = $('.nav-phototeque').height(),
maxHeight = productHeight > windowHeight ? productHeight : containerHeight,
galleryWidth = windowWidth - navPhototequeWidth,
filterWidth = $('.right-container .left-panel').outerWidth(),
footerContact = $('.contact-form .footer').outerHeight();
$('.gallery-wrapper').outerWidth(galleryWidth).css('margin-left',navPhototequeWidth) ;
$('.main,.load-page').outerHeight(containerHeight);
$('.full-height').outerHeight(maxHeight);
$('.nav-content').outerHeight( windowHeight - navHeader - footerHeight);
$('.product-images').outerWidth(windowWidth - productWidth -10);
$('.right-container').outerWidth(windowWidth - navMenuWidth);
$('.position--after-menu').css('left',navMenuWidth);
$('.right-panel').outerWidth(windowWidth - (navMenuWidth + filterWidth));
$('.contact-form').height(windowHeight - footerHeight);
$('.contact-form .inner-form').outerHeight(windowHeight - footerContact);
$('#catalogue .panel-content section').last().css('height','auto');
setTimeout(function(){
var lastSection = $('#catalogue .panel-content section').last();
var lastSectionHeight = lastSection.outerHeight() + 50;
if (lastSectionHeight < windowHeight - footerHeight){
lastSection.height(2 * windowHeight/3 + lastSection.find('h2').outerHeight() - footerHeight );
}else{
lastSection.css('height','auto');
}
},1000)
$('.nav-phototeque .nav-content').outerHeight(navPhototequeHeight - $('.circle-btn').outerHeight()- $('.phototheque-content .header h2').outerHeight() - footerHeight);
if (windowWidth > 860){
$('#fullpage .chevron').css('left',navMenuWidth);
$('.container-bg').css({'height':'100%' , 'width' : navMenuWidth});
$('.main').css('padding-top',0);
$('.contact-form h2').removeClass('show-comm');
$('.filter, .left-panel .map, .details, .contact-form form').show();
$('.left-panel').appendMap();
$('.filter-list,#home').css('margin-top',0);
$('.filter-list .top-header').css('top',"initial");
$('.header .nav-wrapper li.to-replace').append($('.mobile-nav .nav-wrapper li.current ul'));
$('.mobile-nav .nav-wrapper ul').find('li').remove();
}else{
$('.filter').appendMap();
$('.main').css('padding-top',navHeight);
$('.container-bg').css({'height':navHeight});
$('.contact-form h2').addClass('show-comm');
$('.filter-list').css('margin-top',navHeight);
$('.filter-list .top-header, .mobile-nav').css('top',navHeight);
$('.mobile-nav .nav-wrapper ul').appendMobileMenu();
$('#slides').height($('.slides-wrapper').width());
if ($('body #home').length){
$('.main').css('padding-top',0);
}
if ($('.filter-wrapper .header-filter-contact').hasClass('on')){
$('.filter, .left-panel .map, .details').show();
}else{
$('.filter, .left-panel .map, .details').hide();
}
if($('.contact-form .header-filter-contact').hasClass('on')){
$('.contact-form form').show();
}else{
$('.contact-form form').hide();
}
checkFilterContactWrapper();
}
checkFooterNavPosition();
}
$.fn.responsive = function() {
$(".product-details").css('height', 'auto');
var footerHeight = $('footer').height(),
productHeight = $(".product-details").outerHeight(),
productWidth = $(".product-details").outerWidth(),
windowHeight = $(window).innerHeight(),
windowWidth = $(window).width(),
navMenuWidth = $('.nav-wrapper').outerWidth(),
navHeight = $('.nav-header').outerHeight(),
navHeader = $('.nav-header').outerHeight(),
containerHeight = windowHeight - footerHeight,
navPhototequeWidth = $('.nav-phototeque').outerWidth(),
navPhototequeHeight = $('.nav-phototeque').height(),
maxHeight = productHeight > windowHeight ? productHeight : containerHeight,
galleryWidth = windowWidth - navPhototequeWidth,
filterWidth = $('.right-container .left-panel').outerWidth(),
footerContact = $('.contact-form .footer').outerHeight();
$('.gallery-wrapper').outerWidth(galleryWidth).css('margin-left', navPhototequeWidth);
$('.main,.load-page').outerHeight(containerHeight);
$('.full-height').outerHeight(maxHeight);
$('.nav-content').outerHeight(windowHeight - navHeader - footerHeight);
$('.product-images').outerWidth(windowWidth - productWidth - 10);
$('.right-container').outerWidth(windowWidth - navMenuWidth);
$('.position--after-menu').css('left', navMenuWidth);
$('.right-panel').outerWidth(windowWidth - (navMenuWidth + filterWidth));
$('.contact-form').height(windowHeight - footerHeight);
$('.contact-form .inner-form').outerHeight(windowHeight - footerContact);
$('#catalogue .panel-content section').last().css('height', 'auto');
setTimeout(function() {
var lastSection = $('#catalogue .panel-content section').last();
var lastSectionHeight = lastSection.outerHeight() + 50;
if (lastSectionHeight < windowHeight - footerHeight) {
lastSection.height(2 * windowHeight / 3 + lastSection.find('h2').outerHeight() - footerHeight);
} else {
lastSection.css('height', 'auto');
}
}, 1000)
$('.nav-phototeque .nav-content').outerHeight(navPhototequeHeight - $('.circle-btn').outerHeight() - $('.phototheque-content .header h2').outerHeight() - footerHeight);
if (windowWidth > 860) {
$('#fullpage .chevron').css('left', navMenuWidth);
$('.container-bg').css({'height': '100%', 'width': navMenuWidth});
$('.main').css('padding-top', 0);
$('.contact-form h2').removeClass('show-comm');
$('.filter, .left-panel .map, .details, .contact-form form').show();
$('.left-panel').appendMap();
$('.filter-list,#home').css('margin-top', 0);
$('.filter-list .top-header').css('top', "initial");
$('.header .nav-wrapper li.to-replace').append($('.mobile-nav .nav-wrapper li.current ul'));
$('.mobile-nav .nav-wrapper ul').find('li').remove();
} else {
$('.filter').appendMap();
$('.main').css('padding-top', navHeight);
$('.container-bg').css({'height': navHeight});
$('.contact-form h2').addClass('show-comm');
$('.filter-list').css('margin-top', navHeight);
$('.filter-list .top-header, .mobile-nav').css('top', navHeight);
$('.mobile-nav .nav-wrapper ul').appendMobileMenu();
$('#slides').height($('.slides-wrapper').width());
if ($('body #home').length) {
$('.main').css('padding-top', 0);
}
if ($('.filter-wrapper .header-filter-contact').hasClass('on')) {
$('.filter, .left-panel .map, .details').show();
} else {
$('.filter, .left-panel .map, .details').hide();
}
if ($('.contact-form .header-filter-contact').hasClass('on')) {
$('.contact-form form').show();
} else {
$('.contact-form form').hide();
}
checkFilterContactWrapper();
}
checkFooterNavPosition();
}
//Wordpress js login
$('#user_login').attr('placeholder', 'Identifiant');
$('#user_pass').attr('placeholder', 'Mot de passe');
$("#user_login").addClass("my-login-username");
$("#wp-submit").addClass("btn rounded white-btn");
});//END Function
function animateOnScroll(){
var animate = new Animate({
target: '[data-animate]',
animatedClass: 'visible',
offset: [0.1,0.1],
delay: 3,
remove: false,
reverse: true,
scrolled: false,
debug: true,
onLoad: true,
onScroll: true,
onResize: false,
callbackOnInit: function() {
},
callbackOnAnimate: function(element) {
}
});
window.scrollAnimation = animate;
animate.init();
setTimeout(animate.render.bind(animate), 2000);
}
$.fn.animation = function(){
//Catalog page
var product = $('.list-animation article');
product.find('figure img,ul,h3,.new,.download-btn').attr( { 'data-animate':"", 'data-animation-classes':"animated fadeIn" } );
var tlCata = new TimelineMax();
tlCata.from('.right-container .right-panel',0.9,{autoAlpha:0,right:'-100%'},1);
tlCata.from('.right-container .left-panel',0.9,{autoAlpha:0,left:'0'},1);
tlCata.from('.btn-container',0.9,{autoAlpha:0,left:'-50'},1.7);
tlCata.from('.floated-bloc h2',0.9,{autoAlpha:0,marginTop:'-100px'},1.4);
tlCata.from('.floated-bloc .text-content',0.9,{autoAlpha:0,marginLeft:'-40px'},2.2);
setTimeout(function(){$('.form-wrapper').removeClass('hidden-elem').addClass('animated fadeInUp')},1000)
animateOnScroll();
}
function onScrollCover(){
cover = $('.subcat.current a.active').attr("href");
$('.cover-wrapper').each(function () {
coverWrapper = $(this).data('cat');
if (coverWrapper == cover && !($(this).hasClass('current-cover'))) {
$('.cover-wrapper').removeClass('last-current-cover');
$('.cover-desc-wrapper').removeClass('fadeInDown').addClass('animated fadeOutDown')
$('.current-cover').addClass('last-current-cover');
$('.cover-wrapper').removeClass('prev next current-cover');
$(this).prevAll('.cover-wrapper').addClass('prev');
$(this).nextAll('.cover-wrapper').addClass('next');
$(this).addClass('current-cover ');
setTimeout(function(){
$('.current-cover .cover-desc-wrapper').removeClass('fadeOutDown').addClass('animated fadeInDown');
}, 600);
}
});
};
var lastScrollTop = 0;
function onScroll(event){
var scrollPos = $(this).scrollTop(),
titleHeight = ($('.panel section > h2').outerHeight()/2) ;
//items = event.data.items;
items = "li .subcat a";
if ( timer ) clearTimeout(timer);
timer = setTimeout(function(){
onScrollCover();
}, 330);
$(items).each(function () {
var currLink = $(this);
var refElement = $(currLink.attr("href"));
//console.log(currLink);
var windowWidth = $(window).width();
var margin_top = 0;
if(windowWidth > 1920)
margin_top = 150;
else
margin_top = 50;
if (refElement.length && refElement.position().top - ( $(".main").outerHeight() / 2 - titleHeight - $(".footer").outerHeight()- margin_top ) <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
$('.subcat a').removeClass("active");
currLink.addClass("active");
if ($('nav ul ul').find('li.active')){
$('nav ul li').removeClass('current').addClass('off');
parent = currLink.parent().parent().parent();
parent.addClass('current').removeClass('off');
if ( timer2 ) clearTimeout(timer2);
timer2 = setTimeout(function(){
$('.phototheque .off .subcat').stop().slideUp();
parent.find('ul').stop().slideDown();
}, 330);
}
}
else{
currLink.removeClass("active");
}
});
}
function scrollAnchor(elemId, skipZero){
$('.subcat').each(function(){
$(this).find('a[href^="#"]').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
$('a').each(function () {
$(this).removeClass('active');
})
$(this).addClass('active');
var target = this.hash,
menu = target,
temp = 0;
$target = $(target);
//$parent = $('#load-page');
$(elemId).stop().animate({
'scrollTop': $target.position().top //- $parent.offset().top
}, 1000, 'swing', function () {
window.location.hash = target;
});
});
})
}
function checkFooterNavPosition(){
var mainHeight = $('.main-nav .nav-content').height(),
nav = $('.main-nav .nav-content .arrow-white').height() + $('.main-nav .nav-content .arrow-pink').height(),
footerNav = $('.header .nav-content .footer').outerHeight();
footerSpace = mainHeight - (nav + 40) ;
if (footerSpace <= footerNav ){
$('.header .nav-content .footer').addClass('relative');
}else{
$('.header .nav-content .footer').removeClass('relative');
}
}
function checkFilterContactWrapper(){
setTimeout(function(){
if (
($('.contact-form .form-wrapper').outerHeight()
+ $('.filter-wrapper').outerHeight()
+ $('nav .main-nav').outerHeight() + $('.main-nav').outerHeight()) < $(window).outerHeight()
/*&&
( $('.contact-form .form-wrapper').outerHeight() +
$('.contact-form .footer').outerHeight() +
$('.filter-wrapper').outerHeight()
> $(window).outerHeight() )*/
)
{
$('.contact-form .footer').addClass('fixed');
}else{
$('.contact-form .footer').removeClass('fixed');
}
},500)
}
$(window).load( function() {
initFunction();
$('.header .nav-wrapper .nav-content > ul > li').each(function(){
url = $(this).data('img');
$('.img-wrapper').append('<img src='+ url +'>');
})
});//END document load
var timer;
var timer2;
$(window).scroll(function(e) {
onScroll(e);
var elem = $('.home-down-wrapper');
if (elem.length){
var downBTN = $('.home-down-wrapper').offset().top;
if ($(window).scrollTop() > downBTN - $('.nav-header').outerHeight()) {
$('.home-footer-nav .nav-wrapper').addClass('fixed');
}
else {
$('.home-footer-nav .nav-wrapper').removeClass('fixed');
}
}
});
$('#user_login').attr('placeholder', 'Identifiant');
$('#user_pass').attr('placeholder', 'Mot de passe');
$("#user_login").addClass("my-login-username");
$("#wp-submit").addClass("btn rounded white-btn");
});//END Function
function animateOnScroll() {
var animate = new Animate({
target: '[data-animate]',
animatedClass: 'visible',
offset: [0.1, 0.1],
delay: 3,
remove: false,
reverse: true,
scrolled: false,
debug: true,
onLoad: true,
onScroll: true,
onResize: false,
callbackOnInit: function() {
},
callbackOnAnimate: function(element) {
}
});
window.scrollAnimation = animate;
animate.init();
setTimeout(animate.render.bind(animate), 2000);
}
$.fn.animation = function() {
//Catalog page
var product = $('.list-animation article');
product.find('figure img,ul,h3,.new,.download-btn').attr({'data-animate': "", 'data-animation-classes': "animated fadeIn"});
var tlCata = new TimelineMax();
tlCata.from('.right-container .right-panel', 0.9, {autoAlpha: 0, right: '-100%'}, 1);
tlCata.from('.right-container .left-panel', 0.9, {autoAlpha: 0, left: '0'}, 1);
tlCata.from('.btn-container', 0.9, {autoAlpha: 0, left: '-50'}, 1.7);
tlCata.from('.floated-bloc h2', 0.9, {autoAlpha: 0, marginTop: '-100px'}, 1.4);
tlCata.from('.floated-bloc .text-content', 0.9, {autoAlpha: 0, marginLeft: '-40px'}, 2.2);
setTimeout(function() {
$('.form-wrapper').removeClass('hidden-elem').addClass('animated fadeInUp')
}, 1000)
animateOnScroll();
}
function onScrollCover() {
cover = $('.subcat.current a.active').attr("href");
$('.cover-wrapper').each(function() {
coverWrapper = $(this).data('cat');
if (coverWrapper == cover && !($(this).hasClass('current-cover'))) {
$('.cover-wrapper').removeClass('last-current-cover');
$('.cover-desc-wrapper').removeClass('fadeInDown').addClass('animated fadeOutDown')
$('.current-cover').addClass('last-current-cover');
$('.cover-wrapper').removeClass('prev next current-cover');
$(this).prevAll('.cover-wrapper').addClass('prev');
$(this).nextAll('.cover-wrapper').addClass('next');
$(this).addClass('current-cover ');
setTimeout(function() {
$('.current-cover .cover-desc-wrapper').removeClass('fadeOutDown').addClass('animated fadeInDown');
}, 600);
}
});
}
;
var lastScrollTop = 0;
function onScroll(event) {
var scrollPos = $(this).scrollTop(),
titleHeight = ($('.panel section > h2').outerHeight() / 2);
//items = event.data.items;
items = "li .subcat a";
if (timer)
clearTimeout(timer);
timer = setTimeout(function() {
onScrollCover();
}, 330);
$(items).each(function() {
var currLink = $(this);
var refElement = $(currLink.attr("href"));
//console.log(currLink);
var windowWidth = $(window).width();
var margin_top = 0;
if (windowWidth > 1920)
margin_top = 150;
else
margin_top = 50;
if (refElement.length && refElement.position().top - ($(".main").outerHeight() / 2 - titleHeight - $(".footer").outerHeight() - margin_top) <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
$('.subcat a').removeClass("active");
currLink.addClass("active");
if ($('nav ul ul').find('li.active')) {
$('nav ul li').removeClass('current').addClass('off');
parent = currLink.parent().parent().parent();
parent.addClass('current').removeClass('off');
if (timer2)
clearTimeout(timer2);
timer2 = setTimeout(function() {
$('.phototheque .off .subcat').stop().slideUp();
parent.find('ul').stop().slideDown();
}, 330);
}
}
else {
currLink.removeClass("active");
}
});
}
function scrollAnchor(elemId, skipZero) {
$('.subcat').each(function() {
$(this).find('a[href^="#"]').on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$('a').each(function() {
$(this).removeClass('active');
})
$(this).addClass('active');
var target = this.hash,
menu = target,
temp = 0;
$target = $(target);
//$parent = $('#load-page');
$(elemId).stop().animate({
'scrollTop': $target.position().top //- $parent.offset().top
}, 1000, 'swing', function() {
window.location.hash = target;
});
});
})
}
function checkFooterNavPosition() {
var mainHeight = $('.main-nav .nav-content').height(),
nav = $('.main-nav .nav-content .arrow-white').height() + $('.main-nav .nav-content .arrow-pink').height(),
footerNav = $('.header .nav-content .footer').outerHeight();
footerSpace = mainHeight - (nav + 40);
if (footerSpace <= footerNav) {
$('.header .nav-content .footer').addClass('relative');
} else {
$('.header .nav-content .footer').removeClass('relative');
}
}
function checkFilterContactWrapper() {
setTimeout(function() {
if (
($('.contact-form .form-wrapper').outerHeight()
+ $('.filter-wrapper').outerHeight()
+ $('nav .main-nav').outerHeight() + $('.main-nav').outerHeight()) < $(window).outerHeight()
/*&&
( $('.contact-form .form-wrapper').outerHeight() +
$('.contact-form .footer').outerHeight() +
$('.filter-wrapper').outerHeight()
> $(window).outerHeight() )*/
)
{
$('.contact-form .footer').addClass('fixed');
} else {
$('.contact-form .footer').removeClass('fixed');
}
}, 500)
}
$(window).load(function() {
initFunction();
$('.header .nav-wrapper .nav-content > ul > li').each(function() {
url = $(this).data('img');
$('.img-wrapper').append('<img src=' + url + '>');
})
});//END document load
var timer;
var timer2;
$(window).scroll(function(e) {
onScroll(e);
var elem = $('.home-down-wrapper');
if (elem.length) {
var downBTN = $('.home-down-wrapper').offset().top;
if ($(window).scrollTop() > downBTN - $('.nav-header').outerHeight()) {
$('.home-footer-nav .nav-wrapper').addClass('fixed');
}
else {
$('.home-footer-nav .nav-wrapper').removeClass('fixed');
}
}
});
//$(window).bind("scrollStop",onScroll)
$(document).ready(function(){
$(document).on('mouseover','.nav-content li',function(){
$(this).stop(false,true).fadeImage();
});
// Catalog Page : Change product image depending on selected color
$('.product-list article ul li').on('mouseover',function(){
$(this).changeProductImageBg();
});
$('.product-list article').each(function(){
$(this).showProductListColors();
});
$('.filter-bloc .list-color-filter li').setColorToWhite();
setTimeout(function(){
onScrollCover();
}, 330);
$.fn.open_nav();
if ($(document).find('#load-page').children().length){
scrollAnchor("#load-page", true);
}else{
scrollAnchor('html,body', false);
}
$('.news-btn').open_news();
$('.close-btn').close_news();
$('.filter-wrapper').open_filter();
$.fn.checkSelectedFilter();
$.fn.showSubmenu(); //Catalog subMenu
$('#fullpage').fullpageSlide(); //Stories
$.fn.responsive();
$('.list-color-filter li').setBgColorList();
$.fn.animation(); //Global animation for entire site
$.fn.getMenuBg(); //Animation BG Menu
//TODO
$('.cover-wrapper').last().addClass('last');
$('.cover-wrapper').first().addClass('first');
showMap();
$.fn.loadPageContent();
}); //end document ready
$(window).resize(function() {
$.fn.responsive();
}); //end document resize
window.addEventListener("load", function(){
var load_screen = document.getElementById("loading-container");
document.body.removeChild(load_screen);
});
$(document).ready(function() {
$(document).on('mouseover', '.nav-content li', function() {
$(this).stop(false, true).fadeImage();
});
// Catalog Page : Change product image depending on selected color
$('.product-list article ul li').on('mouseover', function() {
$(this).changeProductImageBg();
});
$('.product-list article').each(function() {
$(this).showProductListColors();
});
$('.filter-bloc .list-color-filter li').setColorToWhite();
setTimeout(function() {
onScrollCover();
}, 330);
$.fn.open_nav();
if ($(document).find('#load-page').children().length) {
scrollAnchor("#load-page", true);
} else {
scrollAnchor('html,body', false);
}
$('.news-btn').open_news();
$('.close-btn').close_news();
$('.filter-wrapper').open_filter();
$.fn.checkSelectedFilter();
$.fn.showSubmenu(); //Catalog subMenu
$('#fullpage').fullpageSlide(); //Stories
$.fn.responsive();
$('.list-color-filter li').setBgColorList();
$.fn.animation(); //Global animation for entire site
$.fn.getMenuBg(); //Animation BG Menu
//TODO
$('.cover-wrapper').last().addClass('last');
$('.cover-wrapper').first().addClass('first');
showMap();
$.fn.loadPageContent();
}); //end document ready
$(window).resize(function() {
$.fn.responsive();
}); //end document resize
window.addEventListener("load", function() {
var load_screen = document.getElementById("loading-container");
document.body.removeChild(load_screen);
});
......
......@@ -110,6 +110,14 @@ jQuery(document).ready(function() {
jQuery(window).bind("popstate", function(e) {
var state = e.originalEvent.state;
if ( state === null ) {
var back_link = jQuery('.close-panel .circle-btn a').attr('href');
window.location.href = back_link;
}
});
});
jQuery.urlParam = function(name) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment