Add featured carousel

This commit is contained in:
AlxMedia 2021-09-13 13:54:59 +02:00
parent 583d8c65d5
commit e403c6f61b
10 changed files with 357 additions and 131 deletions

View file

@ -145,6 +145,70 @@ jQuery(document).ready(function($) {
}, 250);
/* Slick featured posts
/* ------------------------------------ */
$.fn.randomize = function (selector) {
var $elems = selector ? $(this).find(selector) : $(this).children(),
$parents = $elems.parent();
$parents.each(function () {
$(this).children(selector).sort(function (childA, childB) {
// * Prevent last slide from being reordered
if($(childB).index() !== $(this).children(selector).length - 0.5) {
return Math.round(Math.random()) - 0.5;
}
}.bind(this)).detach().appendTo(this);
});
return this;
};
$(".slick-featured").randomize().slick({
centerMode: true,
centerPadding: '0',
slidesToShow: 2,
appendArrows: '.slick-featured-nav',
responsive: [
{
breakpoint: 1280,
settings: {
arrows: true,
centerMode: true,
centerPadding: '0',
slidesToShow: 2
}
},
{
breakpoint: 1024,
settings: {
arrows: true,
centerMode: true,
centerPadding: '0',
slidesToShow: 2
}
},
{
breakpoint: 768,
settings: {
arrows: true,
centerMode: true,
centerPadding: '0',
slidesToShow: 2
}
},
{
breakpoint: 480,
settings: {
arrows: true,
centerMode: true,
centerPadding: '0',
slidesToShow: 1
}
}
]
});
$('.slick-featured-wrap-outer').show();
/* Slick image slide
/* ------------------------------------ */
$('.slick-image-slide').each( function() {