我有一个水平滚动旋转木马:
_gotoNext: function (that) {
//tjobbe - put funciton here to check if there is anything else after the last slide, then stop / disable the gotonext. must only scroll one if only one is available (or 2). same for go to prev
that.$element.find('.mediaCarousel').trigger("next", false);
},
//This method tells the mediaCarousel to go to the previous slide.
_gotoPrev: function(that, callback) {
that.$element.find('.mediaCarousel').trigger("prev", false);
},
我需要它停止或至少在到达最后一个项目时禁用下一个按钮。如果有一个非偶数,我还需要它只滚动一个或两个项目,或让它完成三个。
我当前的代码似乎没有注意内置的“无限:真(或假)”选项。
例如,我目前有7个项目,我一次滚动3个项目。我想在第三个滚动停止,这样第二个滚动只会与列表中的项目一样。
如果有可能,有什么想法吗?
答案 0 :(得分:2)
似乎您可以设置循环和无限选项。
我想其中一个会做你想做的事(很可能是无限的):
$('#carousel').carouFredSel({
circular: true, // Determines whether the carousel should be circular.
infinite: true, // Determines whether the carousel should be infinite. Note: It is possible to create a non-circular, infinite carousel, but it is not possible to create a circular, non-infinite carousel.
responsive: false, // Determines whether the carousel should be responsive. If true, the items will be resized to fill the carousel.
direction: "left", // The direction to scroll the carousel. Possible values: "right", "left", "up" or "down".
width: null, // The width of the carousel. Can be null (width will be calculated), a number, "variable" (automatically resize the carousel when scrolling items with variable widths), "auto" (measure the widest item) or a percentage like "100%" (only applies on horizontal carousels)
height: null, // The height of the carousel. Can be null (width will be calculated), a number, "variable" (automatically resize the carousel when scrolling items with variable heights), "auto" (measure the tallest item) or a percentage like "100%" (only applies on vertical carousels)
align: "center", // Whether and how to align the items inside a fixed width/height. Possible values: "center", "left", "right" or false.
padding: null, // Padding around the carousel (top, right, bottom and left). For example: [10, 20, 30, 40] (top, right, bottom, left) or [0, 50] (top/bottom, left/right).
synchronise: null, // Selector and options for the carousel to synchronise: [string selector, boolean inheritOptions, boolean sameDirection, number deviation] For example: ["#foo2", true, true, 0]
cookie: false, // Determines whether the carousel should start at its last viewed position. The cookie is stored until the browser is closed. Can be a string to set a specific name for the cookie to prevent multiple carousels from using the same cookie.
onCreate: null // Function that will be called after the carousel has been created. Receives a map of all data.
});