首页 > Web开发 > 详细

swipejs的bug

时间:2014-11-07 00:47:15      阅读:333      评论:0      收藏:0      [点我收藏+]

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‘;
    }
}

 

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

swipejs的bug

原文:http://www.cnblogs.com/samwu/p/4080220.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!