當前位置:編程學習大全網 - 網站源碼 - swiper.js中怎麽獲取滑動前後的位移值?

swiper.js中怎麽獲取滑動前後的位移值?

普通模式:(當前塊-之前塊)x寬度

move=(mySwiper.activeIndex-mySwiper.previousIndex)*mySwiper.width 。

free模式:現在第壹塊的相對swiper位置-滑動之前位置

onFirstInit: function(swiper){

location1=mySwiper.slides[0].getOffset().left;

}

其他事件{

location2=mySwiper.slides[0].getOffset().left;

move=location2-location1-mySwiper.positions.start;

}

swiper是個功能插件,使用在移動端,相當於jm,jq是javascript的框架庫,主用於平臺兼容,應用在比如連版廣告等需要滑動操作的地方,局限性比較小。

  • 上一篇:delphi 怎麽動態調用ocx中的方法
  • 下一篇:bios version compare error什麽意思
  • copyright 2024編程學習大全網