ajust close item and loader ajax

This commit is contained in:
2019-10-10 18:32:07 +02:00
parent c28778eb23
commit a36123b071
+5 -10
View File
@@ -2,7 +2,7 @@ function click_link() {
$link = $('#text_figli p > a');
$link.click(function(e) {
$link.on('click',function(e) {
e.preventDefault();
var $loader = $(this).find('.loader');
@@ -14,20 +14,17 @@ function click_link() {
project_name = url[3];
if ($this.hasClass('open')) {
$this.removeClass('open');
$('#item_list.'+ cat).remove();
} else {
$('#item_list').remove();
$('.open').removeClass('open');
$loader.css('display','inline-block');
$.ajax({
url : '/' + page + '/' + cat, // La ressource ciblée
type : 'GET', // Le type de la requête HTTP
dataType:'html',
async: false,
success: function(data) {
$(data).find('#item_list').addClass(cat).insertAfter($this);
$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
type : 'GET', // Le type de la requête HTTP
dataType:'html',
// async: false,
success: function(data) {
$('#item_list.'+cat+' .card-image.open #item').remove();
$('#item_list.'+cat+' .card-image').removeClass('open');
@@ -167,17 +163,15 @@ function click_img(e, $this, $href, url, page, cat, project_name) {
lazy();
},
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();
$loader.hide();
$('.loader').hide();
scrollTop();
}
});
}
});
}
function anchor($href) {
@@ -283,6 +277,7 @@ function closeAjax() {
$button.click(function() {
$(this).parent().remove();
$('.card-image').removeClass("open");
});
}