setTimeout(function(){
$=jQuery;
jQuery(document).ready(function(){
let dataFiles = jQuery('html').data('files');
let storeId = jQuery('html').data('store');
jQuery.ajax({
url : `/loja/busca_noticias.php?loja=${storeId}&${dataFiles}`,
method : 'get',
success : function(response){
let target;
let news;
if (!jQuery(response).find('.noticias').length) {
jQuery('.section-notices').remove();
return;
}
jQuery('.section-notices .noticias-content').append('
')
target = jQuery('.section-notices .noticias-content .noticias');
news = jQuery(jQuery(response).find('.noticias'));
news.find('li:nth-child(n+5)').remove();
news.find('li').wrapInner('');
news = news.contents();
news.each(function (index, news) {
let link = jQuery(this).find('#noticia_imagem a').attr('href');
let title = jQuery(this).find('#noticia_dados h3 a').text();
jQuery(this).find('p').after(`Leia mais`);
jQuery(this).find('#noticia_imagem img').attr('alt', title).removeAttr('title');
let image = jQuery(news).find('img');
let source = image.prop('src');
image.attr('data-src', source);
});
target.append(news);
}
});
if ($(window).width() < 769){
setTimeout(function(){
$(".noticias").slick({
lazyLoad: "ondemand",
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
dots: false
});
}, 1000);
$(".jcarousel-skin-tango").slick({
lazyLoad: "ondemand",
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
dots: false
});
$(".jcarousel-skin-tango a").css('width', '100%');
}
});
},100);