nolimits4web / swiper

Most modern mobile touch slider with hardware accelerated transitions
https://swiperjs.com
MIT License
39.58k stars 9.75k forks source link

No Swiping #1052

Closed soupking closed 9 years ago

soupking commented 9 years ago

Hi there,

Really am enjoying Swiper. I feel like this is the coolest lightweight plugin since TweenLite. I'm trying to get the swiping to stop after the initial drag. I'm using 2.4.2 as I'm trying to keep my file as light as possible without breaking, but I can't seem to figure out how to place the syntax to get it to function.

This is essentially what I have on the page:

var mySwiper = new Swiper('.swiper-container',{ pagination: '.pagination', loop:false, grabCursor: true, paginationClickable: true, watchActiveIndex: true, noSwipingClass: true, onSlideChangeEnd: function(swiper){ //alert(mySwiper.width); mySwiper.noSwiping = true; } })

div class="device"> div class="swiper-container"> div class="swiper-wrapper"> div class="swiper-slide">

div class="swiper-slide swiper-no-swiping">
/div> /div> div class="pagination"> /div>

I had to shave the < of the html because it's not showing up in the comment box. and I wasn't having any success with Markdown so hopefully this makes sense.

If anybody can point out what I'm not doing right to make the swiping stop I'd be thrilled.

Thanks for reading! :)

nolimits4web commented 9 years ago
var mySwiper = new Swiper('.swiper-container',{
  pagination: '.pagination',
  loop:false,
  grabCursor: true,
  paginationClickable: true,
  watchActiveIndex: true,
  noSwiping: false,
  onSlideChangeEnd: function(swiper){
    mySwiper.params.noSwiping = true;
  }
})
soupking commented 9 years ago

Bingo! That did it! Excellent Vladimir, thanks a bunch!

I didn't know I had to put 'params' in front of the desired option. Not sure if that's pre-defined in JS but I'll use that syntax going forward using Swiper.

nolimits4web commented 9 years ago

Yes, if you need to change some of initial parameters later, you should access swiper.params object