gpt4 book ai didi

javascript - CarouFredSel - 关闭无限滚动?

转载 作者:行者123 更新时间:2023-12-02 17:52:10 25 4
gpt4 key购买 nike

我有一个水平滚动轮播:

    _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);
},

http://jsfiddle.net/YVCTx/

当到达最后一项时,我需要它停止或至少禁用下一个按钮。如果有非偶数,我也需要它只滚动一两个项目,或者让它滚动全部三个项目。

我当前的代码似乎没有关注内置的“infinite: true (or false)”选项。

例如,我现在有 7 个项目,我一次滚动 3 个。我想在第三个滚动时停止,以便第二个滚动仅按照列表中的项目进行。

如果这可能的话有什么想法吗?

最佳答案

好像有一个循环和一个无限选项可以设置。

我想其中之一会做你想要的(最有可能是无限的):

$('#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.
});

来源:documentation

关于javascript - CarouFredSel - 关闭无限滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21253561/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com