0
我正在使用Cycle Slider Carousel(http://jquery.malsup.com/cycle2/demo/carousel.php),根據屏幕大小,我將不得不從5更改爲3,然後顯示1張幻燈片(傳送帶可見選項)。啓動後是否可以更改循環滑塊中的元素?
我知道如何觀察頁面的寬度以觸發某個函數在低於閾值時改變它,但是我可以調用哪個函數來更改顯示的幻燈片數量?
我正在使用Cycle Slider Carousel(http://jquery.malsup.com/cycle2/demo/carousel.php),根據屏幕大小,我將不得不從5更改爲3,然後顯示1張幻燈片(傳送帶可見選項)。啓動後是否可以更改循環滑塊中的元素?
我知道如何觀察頁面的寬度以觸發某個函數在低於閾值時改變它,但是我可以調用哪個函數來更改顯示的幻燈片數量?
$(window).resize(function() {
onResize();
});
$(window).load(function() {
onResize();
});
function onResize() {
if ($('body').outerWidth() < 640) {
$('.slideshow').attr({'data-cycle-carousel-visible': 'number of element you want to show'});
} else {
if ($('body').outerWidth() > 640 && $('body').outerWidth() < 1024) {
$('.slideshow').attr({'data-cycle-carousel-visible': 'number of element you want to show'});
} else {
$('.slideshow').attr({'data-cycle-carousel-visible': 'number of element you want to show'});
}
}
}
享受:)
更改屬性初始化經歷了不工作後。如果只是這會很簡單 – Fredy31