Commit 12c9ad23 authored by Nahla Shiri's avatar Nahla Shiri

main js

parent e05d98ec
var initFunction=function(){ var initFunction=function(){
};//END init Function };//END init Function
$(function(){
(function($) {
$(function(){
//Stop jump tag //Stop jump tag
$(document).find('a[href^="#"], .easyzoom a').click(function(e){ $(document).find('a[href^="#"], .easyzoom a').click(function(e){
e.preventDefault(); e.preventDefault();
...@@ -47,8 +49,8 @@ $(function(){ ...@@ -47,8 +49,8 @@ $(function(){
},330) },330)
nav.stop().slideToggle(); nav.stop().slideToggle();
}); });
} }
$.fn.loadPageContent = function(){ $.fn.loadPageContent = function(){
if ($('body').find('header').length > 1){ if ($('body').find('header').length > 1){
$('body').find('header').last().parent().remove(); $('body').find('header').last().parent().remove();
...@@ -133,10 +135,10 @@ $.fn.loadPageContent = function(){ ...@@ -133,10 +135,10 @@ $.fn.loadPageContent = function(){
} }
//scroll to bottom //scroll to bottom
$('body').animate({ $('body').animate({
scrollTop: div.outerHeight() scrollTop: div.outerHeight()
}, 1000,'swing',function(){ }, 1000,'swing',function(){
}); });
}).on('click','.scrolled',function(){ }).on('click','.scrolled',function(){
$(this).removeClass('scrolled'); $(this).removeClass('scrolled');
...@@ -149,14 +151,14 @@ $.fn.loadPageContent = function(){ ...@@ -149,14 +151,14 @@ $.fn.loadPageContent = function(){
},600) },600)
return false; return false;
}); });
//Get file name of uploaded file //Get file name of uploaded file
$('#file-p').on('change',function(e){ $('#file-p').on('change',function(e){
var fileName = e.target.files[0].name; var fileName = e.target.files[0].name;
$('.upload-btn').after($('<p class="loaded-file">' + fileName + '</p>')); $('.upload-btn').after($('<p class="loaded-file">' + fileName + '</p>'));
}) })
//END get file name //END get file name
//END load content page on left Panel //END load content page on left Panel
$(document).on('click','.int-link',function(e){ $(document).on('click','.int-link',function(e){
e.preventDefault(); e.preventDefault();
$('.load-page').parent().removeClass('active'); $('.load-page').parent().removeClass('active');
history.pushState(null, null, $(this).find('a').attr('href')); history.pushState(null, null, $(this).find('a').attr('href'));
...@@ -164,7 +166,7 @@ $.fn.loadPageContent = function(){ ...@@ -164,7 +166,7 @@ $.fn.loadPageContent = function(){
tlProduct.reverse(); tlProduct.reverse();
//$('.load-page').removeClass('fadeInUp').addClass('animated fadeOutUp'); //$('.load-page').removeClass('fadeInUp').addClass('animated fadeOutUp');
}); });
$(document).on('click','.acces li .login, .login-user',function(e){ $(document).on('click','.acces li .login, .login-user',function(e){
e.stopImmediatePropagation(); e.stopImmediatePropagation();
var windowWidth = $(window).width(); var windowWidth = $(window).width();
$('.popup-container').fadeIn(); $('.popup-container').fadeIn();
...@@ -176,23 +178,23 @@ $.fn.loadPageContent = function(){ ...@@ -176,23 +178,23 @@ $.fn.loadPageContent = function(){
$('.popup-first').removeClass('fadeOutDown ').addClass('animated visible-elem pulse'); $('.popup-first').removeClass('fadeOutDown ').addClass('animated visible-elem pulse');
}); });
//Close popup //Close popup
$('.popup-first .close-btn').click( $('.popup-first .close-btn').click(
function(){ function(){
$('.popup-first').removeClass('visible-elem pulse').addClass('fadeOutDown'); $('.popup-first').removeClass('visible-elem pulse').addClass('fadeOutDown');
setTimeout(function(){ setTimeout(function(){
$('.popup-container').fadeOut('slow'); $('.popup-container').fadeOut('slow');
},0); },0);
}); });
checkWhiteColor = function(color) { checkWhiteColor = function(color) {
var white = ["#fff","#ffffff","white" ]; var white = ["#fff","#ffffff","white" ];
if ($.inArray(color, white) != -1){ if ($.inArray(color, white) != -1){
color = '#999999'; color = '#999999';
} }
return color; return color;
} }
//checkWhiteColor = function(item) { //checkWhiteColor = function(item) {
$.fn.setColorToWhite = function(item){ $.fn.setColorToWhite = function(item){
//$('.list-wrapper .color-list') //$('.list-wrapper .color-list')
$(this).each(function(){ $(this).each(function(){
elem = item ? $(this).find(item) : $(this), elem = item ? $(this).find(item) : $(this),
...@@ -202,17 +204,17 @@ $.fn.loadPageContent = function(){ ...@@ -202,17 +204,17 @@ $.fn.loadPageContent = function(){
elem.addClass('is-white'); elem.addClass('is-white');
} }
}); });
} }
$.fn.setBgColorList = function(){ $.fn.setBgColorList = function(){
$(this).each(function(){ $(this).each(function(){
$(this).css({ $(this).css({
'background-color' : $(this).data('color'), 'background-color' : $(this).data('color'),
'border' : '1px solid' + checkWhiteColor($(this).data('color')) 'border' : '1px solid' + checkWhiteColor($(this).data('color'))
}) })
}) })
} }
$.fn.showProductListColors = function(){ $.fn.showProductListColors = function(){
var articleWrapper = $(this), var articleWrapper = $(this),
firstPellet = articleWrapper.find('li').first(), firstPellet = articleWrapper.find('li').first(),
articleColor = checkWhiteColor(firstPellet.data('color')); articleColor = checkWhiteColor(firstPellet.data('color'));
...@@ -223,9 +225,9 @@ $.fn.loadPageContent = function(){ ...@@ -223,9 +225,9 @@ $.fn.loadPageContent = function(){
'data-link' : articleLink 'data-link' : articleLink
}); });
$('.product-list article ul li').setBgColorList(); $('.product-list article ul li').setBgColorList();
} }
//FadeIn Image on home page //FadeIn Image on home page
$.fn.fadeImage= function(){ $.fn.fadeImage= function(){
var srcImage = $(this).data('img'); var srcImage = $(this).data('img');
if (srcImage == 'undefined' || !srcImage) if (srcImage == 'undefined' || !srcImage)
{ {
...@@ -233,50 +235,50 @@ $.fn.loadPageContent = function(){ ...@@ -233,50 +235,50 @@ $.fn.loadPageContent = function(){
} }
$('.img-wrapper').removeClass('animate'); $('.img-wrapper').removeClass('animate');
$('.img-wrapper').stop().animate({ $('.img-wrapper').stop().animate({
opacity:0, opacity:0,
}, 500, function() {}); }, 500, function() {});
$('.img-wrapper').stop().animate({ $('.img-wrapper').stop().animate({
opacity:1, opacity:1,
},500, function() { },500, function() {
$('.img-wrapper').addClass('animate'); $('.img-wrapper').addClass('animate');
$('.img-wrapper').css({ $('.img-wrapper').css({
'background-image': "url("+ srcImage +")", 'background-image': "url("+ srcImage +")",
}); });
}); });
} }
$.fn.showSubmenu = function(){ $.fn.showSubmenu = function(){
var currentPage = $('.container').data('page'); var currentPage = $('.container').data('page');
$('header nav').find('ul li').find("[data-page="+currentPage+"]").slideDown(); $('header nav').find('ul li').find("[data-page="+currentPage+"]").slideDown();
$('header nav').find('ul').find("[data-page="+currentPage+"]").addClass('current'); $('header nav').find('ul').find("[data-page="+currentPage+"]").addClass('current');
} }
//animate menu nav //animate menu nav
$.fn.open_nav = function(){ $.fn.open_nav = function(){
TweenLite.set(".nav-content", {visibility : "visible"}); TweenLite.set(".nav-content", {visibility : "visible"});
var tl = new TimelineMax(); 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.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.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); tl.fromTo('.news-btn',0.9,{autoAlpha:0,scale:'0'},{autoAlpha:1,scale:'1'},0);
} }
$.fn.openPanelAnimation = function(){ $.fn.openPanelAnimation = function(){
$(this).addClass('animated slideInRight').removeClass('slideOutRight').show(); $(this).addClass('animated slideInRight').removeClass('slideOutRight').show();
} }
$.fn.closePanelAnimation = function(){ $.fn.closePanelAnimation = function(){
$(this).removeClass('slideInRight').addClass('slideOutRight'); $(this).removeClass('slideInRight').addClass('slideOutRight');
} }
$.fn.open_news = function(){ $.fn.open_news = function(){
$(this).on('click',function(){ $(this).on('click',function(){
$('.news-wrapper').openPanelAnimation(); $('.news-wrapper').openPanelAnimation();
}) })
} }
$.fn.close_news = function(){ $.fn.close_news = function(){
$(this).on('click',function(){ $(this).on('click',function(){
$('.news-wrapper').closePanelAnimation(); $('.news-wrapper').closePanelAnimation();
}) })
} }
$.fn.reinitFilter = function(){ $.fn.reinitFilter = function(){
$(this).removeClass('selected-filter selected'); $(this).removeClass('selected-filter selected');
} }
$.fn.open_filter = function(){ $.fn.open_filter = function(){
$(this).on('click','.filter-btn',function(){ $(this).on('click','.filter-btn',function(){
var filterW = $('.filter-list').outerWidth(), var filterW = $('.filter-list').outerWidth(),
mainW = $('.main-nav').outerWidth(), mainW = $('.main-nav').outerWidth(),
...@@ -324,13 +326,13 @@ $.fn.loadPageContent = function(){ ...@@ -324,13 +326,13 @@ $.fn.loadPageContent = function(){
$('.filter-bloc , .filter-bloc li').reinitFilter(); $('.filter-bloc , .filter-bloc li').reinitFilter();
$('.filter-btn').removeClass('selected-filter'); $('.filter-btn').removeClass('selected-filter');
}); });
} }
$.fn.checkSelectedFilter = function(){ $.fn.checkSelectedFilter = function(){
if ($('.filter-content .filter-bloc.selected-filter').length){ if ($('.filter-content .filter-bloc.selected-filter').length){
$('.filter-btn').addClass('selected-filter'); $('.filter-btn').addClass('selected-filter');
} }
} }
$.fn.changeProductImageBg = function(){ $.fn.changeProductImageBg = function(){
var var
selectedColor = checkWhiteColor($(this).data("color")), selectedColor = checkWhiteColor($(this).data("color")),
selectedImage = $(this).data("image"), selectedImage = $(this).data("image"),
...@@ -340,13 +342,13 @@ $.fn.loadPageContent = function(){ ...@@ -340,13 +342,13 @@ $.fn.loadPageContent = function(){
container.find('.article-bg').css({"background-color": selectedColor, opacity:'0.1'}); container.find('.article-bg').css({"background-color": selectedColor, opacity:'0.1'});
container.find('img').attr({'src' : selectedImage , 'data-link' : linkProduct}); container.find('img').attr({'src' : selectedImage , 'data-link' : linkProduct});
tl.fromTo(container.find('img'),1,{opacity:0,visibility:"hidden"},{opacity:1,visibility:"visible"},0); tl.fromTo(container.find('img'),1,{opacity:0,visibility:"hidden"},{opacity:1,visibility:"visible"},0);
} }
$.fn.animatePageScroll = function(element, duration) { $.fn.animatePageScroll = function(element, duration) {
return $(this).fromTo(element,duration, return $(this).fromTo(element,duration,
{opacity:0,visibility:"hidden",marginBottom:'80px'}, {opacity:0,visibility:"hidden",marginBottom:'80px'},
{opacity:1,visibility:"visible",marginBottom:'0px'},0.7); {opacity:1,visibility:"visible",marginBottom:'0px'},0.7);
} }
$.fn.fullpageSlide = function(){ $.fn.fullpageSlide = function(){
var var
timeout = 1.7, timeout = 1.7,
duration = 1.2; duration = 1.2;
...@@ -355,28 +357,28 @@ $.fn.loadPageContent = function(){ ...@@ -355,28 +357,28 @@ $.fn.loadPageContent = function(){
}, 2000); }, 2000);
$("#fullpage .section").first().addClass('first'); $("#fullpage .section").first().addClass('first');
$(this).fullpage({ $(this).fullpage({
verticalCentered: false, verticalCentered: false,
css3:false, css3:false,
scrollingSpeed: 1500, scrollingSpeed: 1500,
lazyLoading: false , lazyLoading: false ,
fixedElements: 'footer', fixedElements: 'footer',
controlArrows: true, controlArrows: true,
fitToSectionDelay: 800000, fitToSectionDelay: 800000,
fadingEffect: true, fadingEffect: true,
normalScrollElements : ".section .bloc", normalScrollElements : ".section .bloc",
afterLoad: function(anchor, index){ afterLoad: function(anchor, index){
tl1 = new TimelineMax(); tl1 = new TimelineMax();
var firstSection = $("#fullpage .section.first"); var firstSection = $("#fullpage .section.first");
//tl1.animatePageScroll(firstSection,duration); //tl1.animatePageScroll(firstSection,duration);
//console.log(animation); //console.log(animation);
tl1.fromTo(firstSection.find('.bloc .header-bloc'),1.5, tl1.fromTo(firstSection.find('.bloc .header-bloc'),1.5,
{opacity:0,visibility:"hidden",marginBottom:'80px'}, {opacity:0,visibility:"hidden",marginBottom:'80px'},
{opacity:1,visibility:"visible",marginBottom:'0px'},timeout); {opacity:1,visibility:"visible",marginBottom:'0px'},timeout);
tl1.fromTo(firstSection.find('.bloc .desc-content'),1, tl1.fromTo(firstSection.find('.bloc .desc-content'),1,
{opacity:0,visibility:"hidden",marginLeft:'-100px'}, {opacity:0,visibility:"hidden",marginLeft:'-100px'},
{opacity:1,visibility:"visible",marginLeft:'0px'},timeout); {opacity:1,visibility:"visible",marginLeft:'0px'},timeout);
}, },
onLeave: function(index, nextIndex, direction){ onLeave: function(index, nextIndex, direction){
var var
activeSection = $(this), activeSection = $(this),
nextSection = $(this).next(); nextSection = $(this).next();
...@@ -408,7 +410,7 @@ $.fn.loadPageContent = function(){ ...@@ -408,7 +410,7 @@ $.fn.loadPageContent = function(){
}); });
$(document).on('click', '.moveDown', function(){ $(document).on('click', '.moveDown', function(){
$.fn.fullpage.moveSectionDown(); $.fn.fullpage.moveSectionDown();
}); });
} }
$.fn.getMenuBg = function(){ $.fn.getMenuBg = function(){
var imgSrc = $('header .nav-content > ul').find(' > li.current').data('img'), var imgSrc = $('header .nav-content > ul').find(' > li.current').data('img'),
...@@ -447,8 +449,8 @@ $.fn.appendMobileMenu = function(){ ...@@ -447,8 +449,8 @@ $.fn.appendMobileMenu = function(){
},2000) },2000)
} }
//Responsive function //Responsive function
$.fn.responsive = function(){ $.fn.responsive = function(){
var footerHeight = $('footer').height(), var footerHeight = $('footer').height(),
productHeight = $(".product-details").outerHeight(), productHeight = $(".product-details").outerHeight(),
productWidth = $(".product-details").outerWidth(), productWidth = $(".product-details").outerWidth(),
...@@ -522,35 +524,35 @@ $.fn.appendMobileMenu = function(){ ...@@ -522,35 +524,35 @@ $.fn.appendMobileMenu = function(){
checkFilterContactWrapper(); checkFilterContactWrapper();
} }
checkFooterNavPosition(); checkFooterNavPosition();
} }
//Wordpress js login //Wordpress js login
$('#user_login').attr('placeholder', 'Identifiant'); $('#user_login').attr('placeholder', 'Identifiant');
$('#user_pass').attr('placeholder', 'Mot de passe'); $('#user_pass').attr('placeholder', 'Mot de passe');
$("#user_login").addClass("my-login-username"); $("#user_login").addClass("my-login-username");
$("#wp-submit").addClass("btn rounded white-btn"); $("#wp-submit").addClass("btn rounded white-btn");
});//END Function });//END Function
function animateOnScroll(){ function animateOnScroll(){
var animate = new Animate({ var animate = new Animate({
target: '[data-animate]', target: '[data-animate]',
animatedClass: 'visible', animatedClass: 'visible',
offset: [0.1,0.1], offset: [0.1,0.1],
delay: 3, delay: 3,
remove: false, remove: false,
reverse: true, reverse: true,
scrolled: false, scrolled: false,
debug: true, debug: true,
onLoad: true, onLoad: true,
onScroll: true, onScroll: true,
onResize: false, onResize: false,
callbackOnInit: function() { callbackOnInit: function() {
}, },
callbackOnAnimate: function(element) { callbackOnAnimate: function(element) {
} }
}); });
window.scrollAnimation = animate; window.scrollAnimation = animate;
animate.init(); animate.init();
setTimeout(animate.render.bind(animate), 2000); setTimeout(animate.render.bind(animate), 2000);
} }
$.fn.animation = function(){ $.fn.animation = function(){
...@@ -589,14 +591,14 @@ var lastScrollTop = 0; ...@@ -589,14 +591,14 @@ var lastScrollTop = 0;
function onScroll(event){ function onScroll(event){
var scrollPos = $(this).scrollTop(), var scrollPos = $(this).scrollTop(),
titleHeight = ($('.panel section > h2').outerHeight()/2) ; titleHeight = ($('.panel section > h2').outerHeight()/2) ;
//items = event.data.items; //items = event.data.items;
items = "li .subcat a"; items = "li .subcat a";
if ( timer ) clearTimeout(timer); if ( timer ) clearTimeout(timer);
timer = setTimeout(function(){ timer = setTimeout(function(){
onScrollCover(); onScrollCover();
}, 330); }, 330);
$(items).each(function () { $(items).each(function () {
var currLink = $(this); var currLink = $(this);
var refElement = $(currLink.attr("href")); var refElement = $(currLink.attr("href"));
//console.log(currLink); //console.log(currLink);
...@@ -679,7 +681,7 @@ $(window).load( function() { ...@@ -679,7 +681,7 @@ $(window).load( function() {
url = $(this).data('img'); url = $(this).data('img');
$('.img-wrapper').append('<img src='+ url +'>'); $('.img-wrapper').append('<img src='+ url +'>');
}) })
});//END document load });//END document load
var timer; var timer;
var timer2; var timer2;
$(window).scroll(function(e) { $(window).scroll(function(e) {
...@@ -695,7 +697,7 @@ $(window).scroll(function(e) { ...@@ -695,7 +697,7 @@ $(window).scroll(function(e) {
} }
} }
}); });
//$(window).bind("scrollStop",onScroll) //$(window).bind("scrollStop",onScroll)
$(document).ready(function(){ $(document).ready(function(){
$(document).on('mouseover','.nav-content li',function(){ $(document).on('mouseover','.nav-content li',function(){
...@@ -738,13 +740,14 @@ $(document).ready(function(){ ...@@ -738,13 +740,14 @@ $(document).ready(function(){
$(window).resize(function() { $(window).resize(function() {
$.fn.responsive(); $.fn.responsive();
}); //end document resize }); //end document resize
window.addEventListener("load", function(){ window.addEventListener("load", function(){
var load_screen = document.getElementById("loading-container"); var load_screen = document.getElementById("loading-container");
document.body.removeChild(load_screen); document.body.removeChild(load_screen);
}); });
}(jQuery));
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