Can I disable swipe in SlideBox?


#1

Hi guys, I having a draggable gmap in an ion-slide, so I want to disable the swipe event for this SlideBox(only slide by slideTo method). But I can’t find any option about that, any ideal?


#2

Answer my own question:

ion-slide-box
  ion-slide.gmapSlide
    // it's empty
  ion-slide.otherSlide
    // something in other slide

.gmapWarp(ng-if='slideIndex == 0')

It’s an easy hack and works fine with some css. But it’s not easy if I want .gmapWarp have slide and drag effect like other slides. Wish it have some option for that :stuck_out_tongue: .


#3

Here is another way of doing this:

In your controller add a function:

$scope.disableSwipe = function() {
   $ionicSlideBoxDelegate.enableSlide(false);
};

In your view add the ng-init attribute on the slide-box element

<ion-slide-box ng-init="disableSwipe()">

This will disable the slide-event.
You can now use a controller function to slide to a given index like this:

$scope.slideTo = function(index) {
  $ionicSlideBoxDelegate.slide(index);
};

e.g. use it with ng-click on a button:

<button class="button" ng-click="slideTo(0)">First</button>

Turn off draggable ion-slide
#4

Thanks!!
Good point of view~


#5

Thanks! This is what I need as well :smile: