I want to change the transition effect on Nivo Slider based off of which button was pressed. Any ideas of how to accomplish this?
Update To clarify, I meant the next or prev button, not a button on the keyboard. What I'm looking for is if a person presses the next button, a slideToRight transition effect is called. If a person presses the previous button, a slideToLeft transition effect is called. Then icing on the cake would be if someone presses a specific slide, if it slides the correct direction. I love Nivo Slider, but I feel like these should be default choosable actions.
Per the nivo slider documentation here you can change the effect for each slide by adding a custom data attribute onto any or all of the images and it will override nivo's default transition:
You can alter this custom data dynamically by setting an event handler on the document body to look for a keypress and then change the attr of all the images using the snippet below:
You can get more advanced and change to specific types of transitions based on the key pressed by adding some logic in, but this is the general idea. A working fiddle is here: http://jsfiddle.net/gregjuva/2ZXCp/
Using Button
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.