ajust close item and loader ajax
This commit is contained in:
@@ -2,7 +2,7 @@ function click_link() {
|
|||||||
|
|
||||||
$link = $('#text_figli p > a');
|
$link = $('#text_figli p > a');
|
||||||
|
|
||||||
$link.click(function(e) {
|
$link.on('click',function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $loader = $(this).find('.loader');
|
var $loader = $(this).find('.loader');
|
||||||
|
|
||||||
@@ -14,20 +14,17 @@ function click_link() {
|
|||||||
project_name = url[3];
|
project_name = url[3];
|
||||||
|
|
||||||
if ($this.hasClass('open')) {
|
if ($this.hasClass('open')) {
|
||||||
|
|
||||||
$this.removeClass('open');
|
$this.removeClass('open');
|
||||||
$('#item_list.'+ cat).remove();
|
$('#item_list.'+ cat).remove();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$('#item_list').remove();
|
$('#item_list').remove();
|
||||||
$('.open').removeClass('open');
|
$('.open').removeClass('open');
|
||||||
$loader.css('display','inline-block');
|
$loader.css('display','inline-block');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : '/' + page + '/' + cat, // La ressource ciblée
|
url : '/' + page + '/' + cat, // La ressource ciblée
|
||||||
type : 'GET', // Le type de la requête HTTP
|
type : 'GET', // Le type de la requête HTTP
|
||||||
dataType:'html',
|
dataType:'html',
|
||||||
|
async: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$(data).find('#item_list').addClass(cat).insertAfter($this);
|
$(data).find('#item_list').addClass(cat).insertAfter($this);
|
||||||
$this.addClass('open');
|
$this.addClass('open');
|
||||||
@@ -156,7 +153,6 @@ function click_img(e, $this, $href, url, page, cat, project_name) {
|
|||||||
url : '/' + page + '/' + cat + '/' + project_name, // La ressource ciblée
|
url : '/' + page + '/' + cat + '/' + project_name, // La ressource ciblée
|
||||||
type : 'GET', // Le type de la requête HTTP
|
type : 'GET', // Le type de la requête HTTP
|
||||||
dataType:'html',
|
dataType:'html',
|
||||||
// async: false,
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('#item_list.'+cat+' .card-image.open #item').remove();
|
$('#item_list.'+cat+' .card-image.open #item').remove();
|
||||||
$('#item_list.'+cat+' .card-image').removeClass('open');
|
$('#item_list.'+cat+' .card-image').removeClass('open');
|
||||||
@@ -167,17 +163,15 @@ function click_img(e, $this, $href, url, page, cat, project_name) {
|
|||||||
lazy();
|
lazy();
|
||||||
},
|
},
|
||||||
complete:function() {
|
complete:function() {
|
||||||
// var $projet = $("#text_figli .card #item");
|
|
||||||
// var hamburger = "<div id='icone_list'><button class='hamburger hamburger--slider is-active' type='button'><span class='hamburger-box'><span class='hamburger-inner'></span></span></button></div>"
|
|
||||||
// $projet.prepend(hamburger);
|
|
||||||
closeAjax();
|
closeAjax();
|
||||||
$loader.hide();
|
$('.loader').hide();
|
||||||
scrollTop();
|
scrollTop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function anchor($href) {
|
function anchor($href) {
|
||||||
@@ -283,6 +277,7 @@ function closeAjax() {
|
|||||||
|
|
||||||
$button.click(function() {
|
$button.click(function() {
|
||||||
$(this).parent().remove();
|
$(this).parent().remove();
|
||||||
|
$('.card-image').removeClass("open");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user