/*
$('.load-more-blogs-categoria').click(function () {
var row = Number($('#row').val());
var allcount = Number($('#all').val());
var id_categoria = Number($('#id_categoria').val());
var rowperpage = Number($('#quante').val());
row = row + rowperpage;
if (row <= allcount) {
$("#row").val(row);
$.ajax({
url: 'https://www.stephaniebarazzotto.it/assets/ajax/getBlogs.php',
type: 'post',
data: {row: row, rowperpage: rowperpage, id_categoria: id_categoria},
beforeSend: function () {
$(".load-more-blogs-categoria").text("CARICA_ALTRO_CARICAMENTO");
},
success: function (response) {
setTimeout(function () {
console.log("reload 1");
var dati = JSON.parse(response);
var html = '';
$.each(dati.contenuto, function (key, value) {
console.log(key + ": " + JSON.stringify(value));
let newDate = new Date(value.data_inizio_pubblicazione);
newDate = newDate.toLocaleDateString();
html += '';
html += '
';
html += '';
html += '
';
html += 'Read More
';
html += '
';
html += '';
html += '
';
html += '';
});
var $newItems = $(html);
$(".blog_wrapper").append( $newItems ).isotope('appended', $newItems );
var rowno = row + rowperpage;
if (rowno > allcount) {
$('.load-more-blogs-categoria').hide();
} else {
$(".load-more-blogs-categoria").text("BLOG_CARICA_ALTRO");
}
}, 100);
}
});
} else {
$('.load-more-blogs-categoria').text("NEWS_CARICAMENTO");
// Setting little delay while removing contents
setTimeout(function () {
// When row is greater than allcount then remove all class='post' element after 3 element
$('.immagine-album:nth-child(3)').nextAll('.post').remove();
// Reset the value of row
$("#row").val(0);
// Change the text and background
$('.load-more-blogs-categoria').text("BLOG_CARICA_ALTRO");
}, 2000);
}
});
*/
$('.load-more-blogs').click(function () {
var row = Number($('#row').val());
var allcount = Number($('#all').val());
var id_categoria = Number($('#id_categoria').val());
var rowperpage = Number($('#quante').val());
var tipo_oggetto = $('#tipo_oggetto').val();
if(isNaN(id_categoria)){
id_categoria = '';
}
row = row + rowperpage;
if (row <= allcount) {
$("#row").val(row);
/*
$('.load-more-blogs-categoria').click(function () {
var row = Number($('#row').val());
var allcount = Number($('#all').val());
var id_categoria = Number($('#id_categoria').val());
var rowperpage = Number($('#quante').val());
row = row + rowperpage;
if (row <= allcount) {
$("#row").val(row);
$.ajax({
url: 'https://www.stephaniebarazzotto.it/assets/ajax/getBlogs.php',
type: 'post',
data: {row: row, rowperpage: rowperpage, id_categoria: id_categoria},
beforeSend: function () {
$(".load-more-blogs-categoria").text("CARICA_ALTRO_CARICAMENTO");
},
success: function (response) {
setTimeout(function () {
console.log("reload 1");
var dati = JSON.parse(response);
var html = '';
$.each(dati.contenuto, function (key, value) {
console.log(key + ": " + JSON.stringify(value));
let newDate = new Date(value.data_inizio_pubblicazione);
newDate = newDate.toLocaleDateString();
html += '';
html += '
';
html += '';
html += '
';
html += 'Read More
';
html += '
';
html += '';
html += '
';
html += '';
});
var $newItems = $(html);
$(".blog_wrapper").append( $newItems ).isotope('appended', $newItems );
var rowno = row + rowperpage;
if (rowno > allcount) {
$('.load-more-blogs-categoria').hide();
} else {
$(".load-more-blogs-categoria").text("BLOG_CARICA_ALTRO");
}
}, 100);
}
});
} else {
$('.load-more-blogs-categoria').text("NEWS_CARICAMENTO");
// Setting little delay while removing contents
setTimeout(function () {
// When row is greater than allcount then remove all class='post' element after 3 element
$('.immagine-album:nth-child(3)').nextAll('.post').remove();
// Reset the value of row
$("#row").val(0);
// Change the text and background
$('.load-more-blogs-categoria').text("BLOG_CARICA_ALTRO");
}, 2000);
}
});
*/
$('.load-more-blogs').click(function () {
var row = Number($('#row').val());
var allcount = Number($('#all').val());
var id_categoria = Number($('#id_categoria').val());
var rowperpage = Number($('#quante').val());
var tipo_oggetto = $('#tipo_oggetto').val();
if(isNaN(id_categoria)){
id_categoria = '';
}
row = row + rowperpage;
if (row <= allcount) {
$("#row").val(row);
$.ajax({
url: 'https://www.stephaniebarazzotto.it/assets/ajax/getBlogs.php',
type: 'post',
data: {row: row, rowperpage: rowperpage, id_categoria: id_categoria, tipo_oggetto:tipo_oggetto},
beforeSend: function () {
$(".load-more-blogs").html('BLOG_CARICAMENTO');
},
success: function (response) {
setTimeout(function () {
console.log("reload 1");
var dati = JSON.parse(response);
var html = '';
$.each(dati.contenuto, function (key, value) {
console.log(key + ": " + JSON.stringify(value));
let newDate = new Date(value.data_inizio_pubblicazione);
newDate = newDate.toLocaleDateString();
html += '';
html += '
';
html += '';
html += '
';
html += 'Read More
';
html += '
';
html += '';
html += '
';
html += '';
});
var $newItems = $(html);
$(".blog_wrapper").append( $newItems ).isotope('appended', $newItems );
if ($(window).width() > 768) {
e = 0;
$(".js-eq-altezza-blog").each(function () {
$(this).height() > e && (e = $(this).height())
}
), $(".js-eq-altezza-blog").height(e)
}
var rowno = row + rowperpage;
if (rowno > allcount) {
$('.load-more-blogs').hide();
} else {
$(".load-more-blogs").html('BLOG_CARICA_ALTRO');
}
}, 100);
}
});
} else {
$('.load-more-blogs').text("BLOG_CARICA_ALTRO");
setTimeout(function () {
$('.immagine-album:nth-child(3)').nextAll('.post').remove();
$("#row").val(0);
$('.load-more-blogs').text("BLOG_CARICA_ALTRO");
}, 2000);
}
});
$.ajax({
url: 'https://www.stephaniebarazzotto.it/assets/ajax/getBlogs.php',
type: 'post',
data: {row: row, rowperpage: rowperpage, id_categoria: id_categoria, tipo_oggetto:tipo_oggetto},
beforeSend: function () {
$(".load-more-blogs").html('BLOG_CARICAMENTO');
},
success: function (response) {
setTimeout(function () {
console.log("reload 1");
var dati = JSON.parse(response);
var html = '';
$.each(dati.contenuto, function (key, value) {
console.log(key + ": " + JSON.stringify(value));
let newDate = new Date(value.data_inizio_pubblicazione);
newDate = newDate.toLocaleDateString();
html += '';
html += '
';
html += '';
html += '
';
html += 'Read More
';
html += '
';
html += '';
html += '
';
html += '';
});
var $newItems = $(html);
$(".blog_wrapper").append( $newItems ).isotope('appended', $newItems );
if ($(window).width() > 768) {
e = 0;
$(".js-eq-altezza-blog").each(function () {
$(this).height() > e && (e = $(this).height())
}
), $(".js-eq-altezza-blog").height(e)
}
var rowno = row + rowperpage;
if (rowno > allcount) {
$('.load-more-blogs').hide();
} else {
$(".load-more-blogs").html('BLOG_CARICA_ALTRO');
}
}, 100);
}
});
} else {
$('.load-more-blogs').text("BLOG_CARICA_ALTRO");
setTimeout(function () {
$('.immagine-album:nth-child(3)').nextAll('.post').remove();
$("#row").val(0);
$('.load-more-blogs').text("BLOG_CARICA_ALTRO");
}, 2000);
}
});