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

main js

parent e05d98ec
var initFunction=function(){
};//END init Function
$(function(){
(function($) {
$(function(){
//Stop jump tag
$(document).find('a[href^="#"], .easyzoom a').click(function(e){
e.preventDefault();
......@@ -47,8 +49,8 @@ $(function(){
},330)
nav.stop().slideToggle();
});
}
$.fn.loadPageContent = function(){
}
$.fn.loadPageContent = function(){
if ($('body').find('header').length > 1){
$('body').find('header').last().parent().remove();
......@@ -133,10 +135,10 @@ $.fn.loadPageContent = function(){
}
//scroll to bottom
$('body').animate({
scrollTop: div.outerHeight()
}, 1000,'swing',function(){
scrollTop: div.outerHeight()
}, 1000,'swing',function(){
});
});
}).on('click','.scrolled',function(){
$(this).removeClass('scrolled');
......@@ -149,14 +151,14 @@ $.fn.loadPageContent = function(){
},600)
return false;
});
//Get file name of uploaded file
$('#file-p').on('change',function(e){
//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>'));
})
//END get file name
//END load content page on left Panel
$(document).on('click','.int-link',function(e){
//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');
history.pushState(null, null, $(this).find('a').attr('href'));
......@@ -164,7 +166,7 @@ $.fn.loadPageContent = function(){
tlProduct.reverse();
//$('.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();
var windowWidth = $(window).width();
$('.popup-container').fadeIn();
......@@ -176,23 +178,23 @@ $.fn.loadPageContent = function(){
$('.popup-first').removeClass('fadeOutDown ').addClass('animated visible-elem pulse');
});
//Close popup
$('.popup-first .close-btn').click(
//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) {
checkWhiteColor = function(color) {
var white = ["#fff","#ffffff","white" ];
if ($.inArray(color, white) != -1){
color = '#999999';
}
return color;
}
//checkWhiteColor = function(item) {
$.fn.setColorToWhite = function(item){
}
//checkWhiteColor = function(item) {
$.fn.setColorToWhite = function(item){
//$('.list-wrapper .color-list')
$(this).each(function(){
elem = item ? $(this).find(item) : $(this),
......@@ -202,17 +204,17 @@ $.fn.loadPageContent = function(){
elem.addClass('is-white');
}
});
}
}
$.fn.setBgColorList = function(){
$.fn.setBgColorList = function(){
$(this).each(function(){
$(this).css({
'background-color' : $(this).data('color'),
'border' : '1px solid' + checkWhiteColor($(this).data('color'))
})
})
}
$.fn.showProductListColors = function(){
}
$.fn.showProductListColors = function(){
var articleWrapper = $(this),
firstPellet = articleWrapper.find('li').first(),
articleColor = checkWhiteColor(firstPellet.data('color'));
......@@ -223,9 +225,9 @@ $.fn.loadPageContent = function(){
'data-link' : articleLink
});
$('.product-list article ul li').setBgColorList();
}
//FadeIn Image on home page
$.fn.fadeImage= function(){
}
//FadeIn Image on home page
$.fn.fadeImage= function(){
var srcImage = $(this).data('img');
if (srcImage == 'undefined' || !srcImage)
{
......@@ -233,50 +235,50 @@ $.fn.loadPageContent = function(){
}
$('.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({
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(){
});
}
$.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(){
}
//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(){
}
$.fn.openPanelAnimation = function(){
$(this).addClass('animated slideInRight').removeClass('slideOutRight').show();
}
$.fn.closePanelAnimation = function(){
}
$.fn.closePanelAnimation = function(){
$(this).removeClass('slideInRight').addClass('slideOutRight');
}
$.fn.open_news = function(){
}
$.fn.open_news = function(){
$(this).on('click',function(){
$('.news-wrapper').openPanelAnimation();
})
}
$.fn.close_news = function(){
}
$.fn.close_news = function(){
$(this).on('click',function(){
$('.news-wrapper').closePanelAnimation();
})
}
$.fn.reinitFilter = function(){
}
$.fn.reinitFilter = function(){
$(this).removeClass('selected-filter selected');
}
$.fn.open_filter = function(){
}
$.fn.open_filter = function(){
$(this).on('click','.filter-btn',function(){
var filterW = $('.filter-list').outerWidth(),
mainW = $('.main-nav').outerWidth(),
......@@ -324,13 +326,13 @@ $.fn.loadPageContent = function(){
$('.filter-bloc , .filter-bloc li').reinitFilter();
$('.filter-btn').removeClass('selected-filter');
});
}
$.fn.checkSelectedFilter = function(){
}
$.fn.checkSelectedFilter = function(){
if ($('.filter-content .filter-bloc.selected-filter').length){
$('.filter-btn').addClass('selected-filter');
}
}
$.fn.changeProductImageBg = function(){
}
$.fn.changeProductImageBg = function(){
var
selectedColor = checkWhiteColor($(this).data("color")),
selectedImage = $(this).data("image"),
......@@ -340,13 +342,13 @@ $.fn.loadPageContent = function(){
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) {
}
$.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(){
}
$.fn.fullpageSlide = function(){
var
timeout = 1.7,
duration = 1.2;
......@@ -355,28 +357,28 @@ $.fn.loadPageContent = function(){
}, 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,
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,
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){
},
onLeave: function(index, nextIndex, direction){
var
activeSection = $(this),
nextSection = $(this).next();
......@@ -408,7 +410,7 @@ $.fn.loadPageContent = function(){
});
$(document).on('click', '.moveDown', function(){
$.fn.fullpage.moveSectionDown();
});
});
}
$.fn.getMenuBg = function(){
var imgSrc = $('header .nav-content > ul').find(' > li.current').data('img'),
......@@ -447,8 +449,8 @@ $.fn.appendMobileMenu = function(){
},2000)
}
//Responsive function
$.fn.responsive = function(){
//Responsive function
$.fn.responsive = function(){
var footerHeight = $('footer').height(),
productHeight = $(".product-details").outerHeight(),
productWidth = $(".product-details").outerWidth(),
......@@ -522,35 +524,35 @@ $.fn.appendMobileMenu = function(){
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");
}
//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);
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(){
......@@ -589,14 +591,14 @@ 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);
//items = event.data.items;
items = "li .subcat a";
if ( timer ) clearTimeout(timer);
timer = setTimeout(function(){
timer = setTimeout(function(){
onScrollCover();
}, 330);
$(items).each(function () {
}, 330);
$(items).each(function () {
var currLink = $(this);
var refElement = $(currLink.attr("href"));
//console.log(currLink);
......@@ -679,7 +681,7 @@ $(window).load( function() {
url = $(this).data('img');
$('.img-wrapper').append('<img src='+ url +'>');
})
});//END document load
});//END document load
var timer;
var timer2;
$(window).scroll(function(e) {
......@@ -695,7 +697,7 @@ $(window).scroll(function(e) {
}
}
});
});
//$(window).bind("scrollStop",onScroll)
$(document).ready(function(){
$(document).on('mouseover','.nav-content li',function(){
......@@ -738,13 +740,14 @@ $(document).ready(function(){
$(window).resize(function() {
$.fn.responsive();
}); //end document resize
}); //end document resize
window.addEventListener("load", function(){
var load_screen = document.getElementById("loading-container");
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