代码之家  ›  专栏  ›  技术社区  ›  Jason

Jquery工具-可滚动的,循环的-有问题的标志游行,标志不会重新出现,直到最后一个标志显示

  •  1
  • Jason  · 技术社区  · 14 年前

    我对jquery工具/可滚动插件有问题。

    使用circular:true option,在此页上: http://oda.sanscode.com/

    我需要改变循环背后的逻辑,这样就没有明显的差距。

    以下是jquery工具插件的代码:

    // circular loop
        if (conf.circular) {
    
                        //take the last item, prepend it to the itemWrap
            var cloned1 = self.getItems().slice(-1).clone().prependTo(itemWrap),
                 cloned2 = self.getItems().eq(1).clone().appendTo(itemWrap); //take the second item, place it after the itemWrap
    
    
            cloned1.add(cloned2).addClass(conf.clonedClass);
    
            self.onBeforeSeek(function(e, i, time) {
    
    
                if (e.isDefaultPrevented()) { return; }
    
                /*
                    1. animate to the clone without event triggering
                    2. seek to correct position with 0 speed
                */
                if (i == -1) {
                    self.seekTo(cloned1, time, function()  {
                        self.end(0);
                    });
                    return e.preventDefault();
    
                } else if (i == self.getSize()) {
                    self.seekTo(cloned2, time, function()  {
                        self.begin(0);
                    });
                }
    
            });
    
            // seek over the cloned item
            self.seekTo(0, 0);
        }
    

    1 回复  |  直到 14 年前
        1
  •  2
  •   kgiff    13 年前

    jquery工具论坛上有人在这里发布了一个解决方案: http://jquerytools.org/forum/tools/35/46918