How to identify slide-box swip?

Hi All,

How can identify slidebox swipe left or right? There is a slideChanged() method which notify me on slide change but i want to notify on slide change as per the direction Example - Left or Right.
If Slide left-> alert(“Slide left”);
else
Slide right-> alert(“Slide right”);
Is there any way to identify ? Can any one help me?

Thanks.

Hi @max , @mhartington,

Please can you look above issue which i am facing. Can you help me to resolving above issue?

The $index is passed as parameter on the on-slide-changed:

.controller('MyController', function($scope) {

    $scope.currentIndex = 0; // for remembering the index

    $scope.onSlideChanged = function(index) {
        
        if(index > currentIndex) {
            // swiped left, slided right
        } else {
            // swiped right, slided left
        }

        $scope.currentIndex = index; // remember new index
    }
});

view:

<ion-slide-box on-slide-changed="onSlideChanged($index)" active-slide="currentIndex">
</ion-slide-box>
2 Likes

Very nice solution @devqon1

@shashikant this will give you the results you want.

@mhartington

Thanks. Yes it is working. :smile:

There is one more query regarding slide-box-

I have list of item. Item count is not fixed. May be it will minimum 1000 item. On Click of particular item. It will open item detail. item detail page will be slide left and slide right functionality.

I have implemented. But, Due to more item it is taking time to load when we open item detail and also item detail page scroll is not working.

It is creating performance issue. How can i resolve performance issue?

Can you please help me to resolve above problem ?

Thanks.

Any chance you could throw together a codepen