zoukankan      html  css  js  c++  java
  • swipejs的bug

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

    以下bug的修复方式皆来自于网上。

    现在最新的版本是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';
        }
    }

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

  • 相关阅读:
    lists and Dictionaries
    捕获鼠标点击 位置移动
    Preventing and Event from Propagation Through a set of Nested Elements
    瀑布流
    Using Function Closures with Timers
    $.getJSON 的用法
    Overlay 遮罩层
    git常见问题
    spring 全局异常处理
    spring 事务
  • 原文地址:https://www.cnblogs.com/samwu/p/4080220.html
Copyright © 2011-2022 走看看