Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to swipeleft and swiperight

Apologies in advance - this is such a fundamental question: Why are swipeleft and swiperight not working?

(function() {
    $('img').on('swiperight', swipeRight);
    function swipeRight(myEvent){ 
        myEvent.stopPropagation();
        alert('swipeRight');
    };

    $('img').on('swipeleft', swipeLeft);
    function swipeLeft(myEvent) { 
        myEvent.stopPropagation();
        alert('swipeLeft');
    };
})();

I've loaded jQuery, but do I need to load a entire library like jQuery Mobile or Angular? I just want to slide from 1 picture to the next.

like image 319
Phillip Senn Avatar asked Nov 26 '25 14:11

Phillip Senn


1 Answers

Standard jQuery doesn't define a swiperight or swipeleft event. jQuery Mobile does, however. You'll have to load that library to utilize those event handlers.

like image 53
Zajn Avatar answered Nov 28 '25 03:11

Zajn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!