swipejs的bug

Github:https://github.com/thebird/Swipe

现在最新的版本是2.0,bug如下:

 

1.触摸后不会自动播放

修复方式

function stop() {  
  
    //delay = 0;  
    delay = options.auto > 0 ? options.auto : 0;  
    clearTimeout(interval );  
  
  }

 

2.小于三个轮播元素,会多生成轮播元素

修复方式

//Source codes: 
 if (browser.transitions && options.continuous && slides.length < 3) {
      element.appendChild(slides[0].cloneNode(true));
      element.appendChild(element.children[1].cloneNode(true));
      slides = element.children;
    }

//Modified codes:

  //special case if two slides
    if (browser.transitions && options.continuous && slides.length < 3) {
      //element.appendChild(slides[0].cloneNode(true));
      //element.appendChild(element.children[1].cloneNode(true));
      //slides = element.children;
    }

 

3.不同高度的轮播元素,矮的那位下面会有空白(为了布局稳定性,也不能说bug)

var height, heights = [];

function setup() {
    //前面不变... 
    container.style.visibility = 'visible'; //在这之后加 
    container.style.height = slides[index].offsetHeight + 'px'; //修复不同高度之间的切换 

}

function slide(to, slideSpeed) {
    //前面不变... 
    offloadFn(options.callback && options.callback(index, slides[index])); //在这之后加 
    setHeight(to);
}

function setHeight(index) { //修复不同高度之间的切换 
    if (-1 < index && index < slides.length) {
        height = slides[index].offsetHeight;
        container.style.height = height + 'px';
    }
}

以上代码来自于网上,只验证过前面两条。

转载于:https://www.cnblogs.com/8ways/articles/4329989.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值