direction: integer instead of next/prev with v9.5.1

bernd.bammer's Avatar

bernd.bammer

15 Nov, 2013 06:19 PM

Hi, I used royalslider v9.4.92

to get the direction I used

slider.ev.on('rsBeforeMove', function(e, type) {
   // "type" is direction, or ID of slide to move
    direction = (type);
});

which worked fine, no matter if you click on the arrow, use the keyboard oder slide with the mouse on the desktop or swipe on an ipad

direction was "next" or "prev"

Now I updated to v9.5.1 (issues with ie11 on swipe with mouse)

clicking or using the keyboard gives "next" or "prev" (which is fine), but using swipe on ipad or swipe with mouse gives me an integer (probably the number of the slide)

How can I get the next/prev value?

best regards

Bernd

  1. Support Staff 1 Posted by Dmitry Semenov on 16 Nov, 2013 11:52 AM

    Dmitry Semenov's Avatar

    Hi,

    It's changed because now it's possible to swipe through multiple slides at once. It's a bad idea to determine direction based on animation type, you should calculate new id, e.g. like so:

    slider.ev.on('rsBeforeMove', function(e, type) { 
    
    if(type === 'next') {
      newItemId = slider.currSlideId+1;
    } else if(type === 'prev') {
      newItemId = slider.currSlideId-1;
    } else {
      newItemId =  parseInt(type, 10);
    }
    
    });
    

    and then based on it determine direction.

    Dmitry

  2. 2 Posted by bernd.bammer on 16 Nov, 2013 12:46 PM

    bernd.bammer's Avatar

    Thank you!

    that will work for me

    is there a way to turn off swipe trough multiple slides?

    best regards

    Bernd

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