This commit is contained in:
2019-12-03 19:09:35 +01:00
parent c31a4942c0
commit 7ca69e1549
20 changed files with 472 additions and 141 deletions
File diff suppressed because one or more lines are too long
+65 -21
View File
@@ -31,7 +31,7 @@ function click_link() {
lazy();
},
complete: function(data) {
console.log('cat', cat);
// console.log('cat', cat);
$loader.hide();
click_img(e, $this, $href, url, page, cat, project_name);
closeAjax();
@@ -45,6 +45,7 @@ function click_list() {
var $link = $('.list-projets li > a');
$link.click(function(e) {
$('.sidebar-right, .sidebar-right button.hamburger').removeClass('is-active');
e.preventDefault();
var $this = $(this);
$href = $this.attr("href");
@@ -58,10 +59,8 @@ function click_list() {
var $link_card = $('.card > #'+project_name + ' a');
if ($link_txt.hasClass('open') && $link_card.parent().hasClass('open') ) {
anchor($href);
}else if ($link_txt.hasClass('open')) {
} else if ($link_txt.hasClass('open')) {
anchor($href);
$.ajax({
url : '/' + page + '/' + cat + '/' + project_name, // La ressource ciblée
@@ -78,10 +77,12 @@ function click_list() {
complete: function(data) {
marg_item(project_name);
closeAjax();
anchor($href);
},
});
} else {
$('#item_list').remove();
$('.open').removeClass('open');
@@ -100,11 +101,11 @@ function click_list() {
click_img(e, $this, $href, url, page, cat, project_name)
},
complete: function(data) {
console.log('cat', cat);
// console.log('cat', cat);
var $link_card = $('.card > #'+project_name + ' a');
setTimeout( function(){
console.log('project_name', project_name);
console.log('$link_card', $link_card);
// console.log('project_name', project_name);
// console.log('$link_card', $link_card);
if ($link_card.hasClass('open')) {
}else {
anchor($href);
@@ -121,6 +122,7 @@ function click_list() {
marg_item(project_name);
closeAjax();
anchor($href);
scrollTop();
},
});
}
@@ -132,6 +134,7 @@ function click_list() {
}
function click_img(e, $this, $href, url, page, cat, project_name) {
$('section.' + cat +' .card-image > a').click(function(e) {
var $this = $(this);
$href = $this.attr("href");
@@ -161,24 +164,30 @@ function click_img(e, $this, $href, url, page, cat, project_name) {
marg_item(project_name);
anchor($href);
lazy();
scrollTop();
// ScrollReveal().reveal($('#item_list > .card'), {
// duration: 1000,
// distance: '10px',
// });
},
complete:function() {
closeAjax();
$('.loader').hide();
scrollTop();
}
});
}
});
}
function anchor($href) {
var aTag = $("a[href='"+ $href +"']");
var aTag = $("#text_figli a[href='"+ $href +"']");
console.log(aTag);
// console.log('aTag.offset()', aTag.offset().top+10);
$('html,body').animate({scrollTop: aTag.offset().top-7},'slow');
$('html,body').animate({scrollTop: aTag.offset().top - 7},'slow');
}
@@ -209,7 +218,7 @@ function mouseHover() {
link_id = $(this).attr("id");
$('html').append("<div class=circle_hover ></div>");
console.log('link_id',link_id);
// console.log('link_id',link_id);
setTimeout(function () {
$('.circle_hover').addClass('open '+ link_id);
@@ -245,14 +254,6 @@ function lazy() {
});
}
function redirection() {
var url = document.location.href;
console.log(url);
if (url != 'https://figureslibres.kevintessier.net/') {
document.location.href="https://figureslibres.kevintessier.net/"
}
}
function animate_burger() {
var forEach=function(t,o,r){if("[object Object]"===Object.prototype.toString.call(t))for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&o.call(r,t[c],c,t);else for(var e=0,l=t.length;l>e;e++)o.call(r,t[e],e,t)};
var hamburgers = document.querySelectorAll(".hamburger");
@@ -297,12 +298,55 @@ function scrollTop() {
})
}
function imgmouse() {
var currentMousePos = { x: 0, y: 0 };
var $img = $('.list-projets .img');
$(document).mousemove(function(event) {
currentMousePos.x = event.pageX;
currentMousePos.y = event.pageY;
$img.css('left', currentMousePos.x );
$img.css('top', currentMousePos.y );
});
}
function scrollreveal() {
var $txt = $('#text_figli p');
ScrollReveal().reveal($txt, {
duration: 1000,
distance: '10px',
});
var $button = $('.sidebar button');
var $title_menu = $('.title-menu h2');
$button.click(function() {
ScrollReveal().destroy($txt, {
duration: 1000,
distance: '10px',
});
});
}
function clickmenu() {
var $menu = $('.sidebar-right button');
$menu.click(function() {
$('#text_figli').toggleClass('hidden');
})
}
$(document).ready(function($){
// redirection();
scrollreveal();
click_link();
click_list();
mouseHover();
animate_burger();
croix();
imgmouse();
clickmenu();
});