javascriptjquerynivo-slider

Nivo Slider sliding workaround (not always sliding in one direction)


Let me prefix this by saying how much I love this community here at stackoverflow, and its always a great help to browse and as questions here, so thanks a lot!

The problem. So I have a client that would like a slideshow that can slide the images from the right->to->left if the right navigation arrow is pressed and from left->to->right if the left arrow is pressed.

Currently in the configuration documentation for nivo-slider(its the only one I really ever use) I cant seem to get anything apart from either always sliding right or always sliding left (slideInLeft, slideInRight).

Is there anyway, to for instance, depict which is pressed, and run that animation method instead of the usual one?

Thanks in advance, Aleski.


Solution

  • Add this to "jquery.nivo.slider.js" before comment "// Run effects" after comment and code in "// Custom transition as defined by "data-transition" attribute". This show change current effect if you click on left or right arrow or buttons. For this work you must have imageis in HTML without "data-transition" attribute and default effect you must define in "jquery.nivo.slider.js" under comment "//Default settings" because "data-transition" attribute is prefer. I code it right know for my project.

            if(nudge === 'prev'){
                currentEffect = 'slideInLeft';
            } 
            else if (nudge === 'next'){
                currentEffect = 'slideInRight';
            }
            else if (nudge === 'control'){
                currentEffect = 'fade'; /*test*/
            }