API Called Direction

helmbold's Avatar

helmbold

06 Apr, 2013 03:47 PM

Hi,

i am trying to figure out how to get which direction was called with slider.ev.on(rsBeforeAnimStart) but i can't find the information in the documentation. For example if i click on the right arrow i want to get the information direction / transition: "right". So i can trigger something when the end of the slideshow is reached and one still clicks the right arrow to load the (not existing) next slide.

Thanks in advance.

Update:

I managed to extend the next and prev function for the result i want:

    // Extend Prev
    slider.prev = function( /* optional_arguments */  ) {
        // First Slide
        if ( slider.currSlideId+1 == 1 ) {
                            // First Slide - do something
            console.log("Tried to go prev the first slide");
        } else {                        
            $.rsProto.prev.call(this /* , optional_arguments */ ); 
        }
    };

But i can't trigger the console.log when i drag the slideshow. It seems dragging ignores prev and next methods.

  1. Support Staff 1 Posted by Dmitry Semenov on 07 Apr, 2013 08:05 AM

    Dmitry Semenov's Avatar

    Hi,

    There is type parameter in rsBeforeMove callback that is direction ("next" or "prev", or ID of slide to move).

    slider.ev.on('rsBeforeMove', function(e, type) {
        var nextIndex = slider.currSlideId;
        if(type === 'next') {
           nextIndex++;
        } else if(type === 'prev') {
           nextIndex--;
        } else {
           nextIndex = type;
        }
    
         var newSlide = slider.slides[nextIndex];
         if(newSlide) {
            // new slide element would be: newSlide.content
         }
    });
    

    http://dimsemenov.com/plugins/royal-slider/documentation/#api

    Dmitry

  2. helmbold closed this discussion on 07 Apr, 2013 03:57 PM.

Comments are currently closed for this discussion. You can start a new one.

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