96
| <![CDATA[<script>
fetchData('news/?page=1&perpage=9').then(response => {
const sliderList = document.querySelector('#slider .splide__list');
const boxNews = document.querySelector('.news-bottom');
let slide = '';
let news = '';
let x = 0;
response.data.forEach(obj => {
let {idNoticia, nomeCategoria, tituloNoticia, fotoPrincipal} = obj;
if(x < 7)
slide += `<li class="splide__slide">
<a href="${env.URL + 'noticia/' + idNoticia + '/' + slugify(tituloNoticia)}">
<span class="title">${tituloNoticia}</span>
<img data-splide-lazy="${env.URL_TMP}arquivosNoticiasInterna/${fotoPrincipal}" alt="${tituloNoticia}">
</a>
</li>`;
else
news += `<article class="second">
<a href="${env.URL + 'noticia/' + idNoticia + '/' + slugify(tituloNoticia)}">
<img src="${env.URL_TMP}arquivosNoticiasInterna/${fotoPrincipal}" alt="${tituloNoticia}">
<span class="title">${tituloNoticia}</span>
</a>
</article>`;
/*
if(x < 7)
slide += `<li class="splide__slide">
<a href="${env.URL + 'noticia/' + idNoticia + '/' + slugify(tituloNoticia)}">
<span class="title">${tituloNoticia}</span>
<span class="category">${nomeCategoria}</span>
<img src="${env.URL_TMP}arquivosNoticiasInterna/${fotoPrincipal}" alt="${tituloNoticia}">
</a>
</li>`;
else
news += `<article class="second">
<a href="${env.URL + 'noticia/' + idNoticia + '/' + slugify(tituloNoticia)}">
<img src="${env.URL_TMP}arquivosNoticiasInterna/${fotoPrincipal}" alt="${tituloNoticia}">
<span class="category">${nomeCategoria}</span>
<span class="title">${tituloNoticia}</span>
</a>
</article>`;
*/
x ++;
});
sliderList.innerHTML = slide;
boxNews.innerHTML = news;
new Splide('#slider', {
autoplay: true,
interval: 3000,
rewind: true,
type: 'slide',
/* arrows: false, */
lazyLoad: 'nearby'
}).mount();
});
</script>]]>
|