Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/410.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使JCarousel垂直滚动条反向滚动?_Javascript_Jquery_Jcarousel - Fatal编程技术网

Javascript 如何使JCarousel垂直滚动条反向滚动?

Javascript 如何使JCarousel垂直滚动条反向滚动?,javascript,jquery,jcarousel,Javascript,Jquery,Jcarousel,我能够使用jQueryJCarousel实例化一个工作的滚动程序,但是我需要它来反向滚动。例如,现在我有: jQuery(document).ready(function() { jQuery('#mycarousel').jcarousel({ auto: 1, vertical: true, scroll: 1, animation: "slow", wrap: 'last', initC

我能够使用jQueryJCarousel实例化一个工作的滚动程序,但是我需要它来反向滚动。例如,现在我有:

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 1,
        vertical: true,
        scroll: 1,
        animation: "slow",
        wrap: 'last',
        initCallback: mycarousel_initCallback
    }); 
});
我需要做什么才能使项目向上滚动而不是向下滚动


提前感谢您

反向自动滚动尚未实现,尽管您可以很容易地编写代码

这是jCarousel中的自动滚动功能:

/**
 * Starts autoscrolling.
 *
 * @method auto
 * @return undefined
 * @param s {Number} Seconds to periodically autoscroll the content.
 */
    startAuto: function(s) {
        if (s != undefined)
            this.options.auto = s;

        if (this.options.auto == 0)
            return this.stopAuto();

        if (this.timer != null)
            return;

        var self = this;
        this.timer = setTimeout(function() { self.next(); }, this.options.auto * 1000);
    },
(中的第687至706行)

更改
self.next()
to
self.prev()
应该是技巧的一部分(现在不能测试它,如果你测试了,请发布结果)


祝您好运:)

反向自动滚动尚未实现,尽管您可以非常轻松地编写代码

这是jCarousel中的自动滚动功能:

/**
 * Starts autoscrolling.
 *
 * @method auto
 * @return undefined
 * @param s {Number} Seconds to periodically autoscroll the content.
 */
    startAuto: function(s) {
        if (s != undefined)
            this.options.auto = s;

        if (this.options.auto == 0)
            return this.stopAuto();

        if (this.timer != null)
            return;

        var self = this;
        this.timer = setTimeout(function() { self.next(); }, this.options.auto * 1000);
    },
(中的第687至706行)

更改
self.next()
to
self.prev()
应该是技巧的一部分(现在不能测试它,如果你测试了,请发布结果)


祝你好运:)

只需将此添加到XaviEsteve的答案中即可(无论如何,我找不到地方为他的答案添加评论)

一旦我将self.next()更改为self.prev(),我就必须将“wrap”选项更改为“tware”,以使其适合我,如下所示

jQuery('#mycarousel').jcarousel({
        auto: 1,
        wrap: 'both',
        vertical: true, 
        scroll: 1,
        start: 30,
        initCallback: mycarousel_initCallback
    });

只需将此添加到XaviEsteve的答案中(无论如何,我找不到一个地方为他的答案添加评论)

一旦我将self.next()更改为self.prev(),我就必须将“wrap”选项更改为“tware”,以使其适合我,如下所示

jQuery('#mycarousel').jcarousel({
        auto: 1,
        wrap: 'both',
        vertical: true, 
        scroll: 1,
        start: 30,
        initCallback: mycarousel_initCallback
    });

事实上,这比那更简单

scroll: -1

干杯

事实上,这比那更简单

scroll: -1

干杯

试试这个,它应该会起作用

$(document).ready(function() {
    $('#mycarousel').jcarousel({
      vertical: true,
      wrap: 'circular',
      animate: 'slow',
    });  
    $('#mycarousel').jcarouselAutoscroll({
      interval: 3000,
      target: '-=1', /*if you change - on + it will scroll up*/
      autostart: true
  });
});

试试这个,应该有用

$(document).ready(function() {
    $('#mycarousel').jcarousel({
      vertical: true,
      wrap: 'circular',
      animate: 'slow',
    });  
    $('#mycarousel').jcarouselAutoscroll({
      interval: 3000,
      target: '-=1', /*if you change - on + it will scroll up*/
      autostart: true
  });
});

非常感谢您的快速回复。我特别将第705行更改为:this.timer=setTimeout(function(){self.prev();},this.options.auto*1000);现在,滚动条没有滚动,Firebug中也没有任何错误。我必须特别使用“开始”选项并手动设置我的索引,因为它从1开始,没有“上一个”可返回。再次感谢!非常感谢您的快速回复。我特别将第705行更改为:this.timer=setTimeout(function(){self.prev();},this.options.auto*1000);现在,滚动条没有滚动,Firebug中也没有任何错误。我必须特别使用“开始”选项并手动设置我的索引,因为它从1开始,没有“上一个”可返回。再次感谢!