API
May 14, 2014 · View on GitHub
Options
Revolver's defaults can be overwritten upon instantiation (as the second argument to the constructor) or at any time there-after (through the setOptions() method).
- autoPlay: Dictates whethor or not Revolver will begin playing immediately.
- container: Dom element that wraps all slide elements.
- containerSelector: String selector used to find the container element.
- slides: Array of dom elements (slides).
- slidesSelector: String selector used to find slides dom elements.
- onPause(): A callback that is executed every time the pause() method is called.
- onPlay(): A callback that is executed every time the play() method is called.
- onReady(): A callback that is executed as soon as Revolver is completely setup and ready to go.
- onRestart(): A callback that is executed every time the restart() method is called.
- onStop(): A callback that is executed every time the stop() method is called.
- rotationSpeed: The number of milliseconds to stay on each slide before transitioning to the next.
- transition: The transition option is just a namespace for the options that are specific to the transition itself.
- name: The type of transition to use for all transitions. See here for the full list of available transitions.
- onComplete(): A callback that is executed every time the transition's animation has completed.
- onStart(): A callback that is executed every time the transition's animation has started.
Events
Revolver emits important events and exposes an event api so that you can hook into the core without actually having to hardcode your changes directly into the core.
- pause: Fired every time the pause() method is called.
- play: Fired every time the play() method is called.
- ready: Fired after instantiation as soon as Revolver is completely setup and ready to go.
- restart: Fired every time the restart() method is called.
- stop: Fired every time the stop() method is called.
- transitionStart: Fired every time the transition's animation has started.
- transitionComplete: Fired every time the transition's animation has completed.
Instance Methods
Once you have instantiated Revolver, as shown here, you then have access to all these methods.
- addSlide(): Add a new slide to the slides array.
- first(): Transition immediately to the first slide.
- goTo(): Transition immediately to any given slide.
- last(): Transition immediately to the last (not previous) slide.
- next(): Transition immediately to the next slide.
- pause(): Stops the slider but remembers it's position.
- play(): Creates a continuous loop where the slider transitions to the next slide at the given interval.
- previous(): Transition immediately to the previous slide.
- reset(): Queues up the first slide to be next without forcing the transition to happen immediately.
- restart(): This is the functional equivalent to calling stop() and then play() consecutively.
- off(): Removes a previously registered event listener.
- on(): Registers an event listener.
- one(): Alias for
on()except that the handler will removed after the first execution. - setOptions(): Merge new options with the existing options object.
- stop(): Stops the slider from transitioning to the next slide, and resets the slider.
- trigger(): Executes all listeners for the given event.
Instance Properties
Once you have instantiated Revolver, as shown here, you then have access to all these properties.
- currentSlide: Holds the index number for the current slide.
- disabled: Used internally to disable all functionality within a Revolver instance.
- intervalId: The ID that Revolver uses to when stopping or pausing playback.
- isAnimating: Equal to true if Revolver is currently animating, false if not.
- iteration: A running count of how many times Revolver has transitioned.
- lastSlide: Holds the index key of the last (not previous) slide in the slider.
- nextSlide: Holds the index key of the next slide in the slider.
- numSlides: A count of the total number of slides that Revolver is acting upon.
- options: A congegation of all user-defined options, plugin-defined options, and Revolver's defaults.
- previousSlide: Holds the index key of the slide that was last in transition (before the current one).
- slides: Houses all the individual slides that Revolver is acting upon.
- status: The current status of the Revolver instance, whether it is "stopped", "paused", or "playing".
Static Methods
Certain methods do not need access to a specific instance of Revolver and can be called on the Revolver object itself.
- [**.md): Internally used for DOM traversal.
- setSelectorEngine(): Make Revolver use a third-party selector engine.
- registerTransition(): Register a custom transition with Revolver.