Event for swiping to change slide (only)

nkc's Avatar

nkc

11 May, 2013 03:57 AM

I have a client that wants to track how the user changes a slide in three separate ways.
1. Clicking the rsBullet dots
2. Clicking the arrows
3. Swiping

I can add jquery events to listen to clicks of the bullets and arrows, but can't figure out what to do for the swipes. The problem is that rsDragRelease fires even when you just click on a slide. And I cant use rsAfterSlideChange because that will also capture clicks of the arrows and bullets. Any advice for me?

Thanks.

  1. Support Staff 1 Posted by Dmitry Semenov on 12 May, 2013 05:02 PM

    Dmitry Semenov's Avatar

    Hi,

    Check - https://gist.github.com/dimsemenov/56a789ae06bbae049acb Haven't tested, but theoretically should work, you might need to add some timeout to rsAfterSlideChange because of click delay on touchdevices.

    Dmitry

  2. 2 Posted by nkc on 12 May, 2013 06:24 PM

    nkc's Avatar

    Ok, I'll go that direction. Thanks.

  3. 3 Posted by Hannes on 17 May, 2018 12:07 PM

    Hannes's Avatar

    How can I be sure that the rsAfterSlideChange event was not triggered via autoplay in your example?

  4. 4 Posted by Hannes on 17 May, 2018 12:26 PM

    Hannes's Avatar

    e.target.dragSuccess ?

  5. Support Staff 5 Posted by Dmitry Semenov on 17 May, 2018 03:42 PM

    Dmitry Semenov's Avatar

    @Hannes, you may disable default autoPlay functionality (or exclude module itself) and write your own.

    There is also a flag in rsBeforeMove event that determines whether an action was performed by a user or by a script.

    slider.ev.on('rsBeforeMove', function(event, type, userAction ) {
        // before any slide transition starts (including after drag release)
        // "type" - can be "next", "prev", or ID of a slide
        // userAction (Boolean) - defines if action is triggered by user (e.g. will be false if movement is triggered by autoPlay)
    });
    

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac