mirror of
https://ghproxy.net/https://github.com/AlxMedia/cardstyle.git
synced 2025-08-26 15:54:09 +08:00
Add featured carousel
This commit is contained in:
parent
583d8c65d5
commit
e403c6f61b
10 changed files with 357 additions and 131 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue