Skip to content

mneil/jQuery-Content-Rotator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Methods

Method Description
rotator Creates a new instance of the rotator plugin
goNext Sends the rotator to the next child index
goToIndex Sends the rotator to the user defined index in the parameter
onError Dispatches an error object relaying the target failure and error message
pause Pauses the rotator.
start Starts the rotator.

Properties

Property Description
arrows The class of the left and right arrow controls with unique number 0 indexed
tranSpeed The time a transition should last in milliseconds
delay The time a child should display before the transition in milliseconds
auto Sets auto scrolling through rotator. true starts animation automatically. false disables auto rotating
loop Infinite scroll on or off, default true infinitely loops
backwards sets the rotator to run backwards. Loop must be set to true to run backwards
onChange onChange event fires when the transition animation begins
endChange endChange event fires when the transition animation ends

Method Detail

rotator

Description: Creates a new instance of the rotator plugin

$(".slider").rotator();

goNext

Description: Sends the rotator to the next child index

$(".slider").data('rotator').goNext();

goNext also accepts a parameter of 1 or -1. This will cause the rotator to either rotate backwards to the previous child or continue forwards.

goToIndex

Description: Sends the rotator to the next child index

$(".slider").data('rotator').goToIndex(2);

The rotator will animate to the child specified. If the child is out of range an error is thrown and the rotator will continue on like normal.

onError

Description: Dispatches an error object relaying the target failure and error message

$(".slider").data('rotator').onError = function(e){alert("error in "+e.target)}

The error object contains two properties; target and error. The target is where the rotator failed. For example, it may be in the initializing where too few children are present in the slider ( the target would be init) or when goToIndex is called with an index out of range (target is goToIndex). The error is a descriptive error message of the failure.

pause

Description: Pauses the rotator

$(".slider").data('rotator').pause();

Clears the interval at which the slider is rotating if auto is true (default).

start

Description: Starts the rotator

$(".slider").data('rotator').start();

Starts the rotator rotating regardless of auto. Can be used to restart a paused rotator or start a rotator whose auto property is set to false. This will set auto to true and the rotator will continue rotating until paused again.

Property Detail

arrows

Description: The class of the left and right arrow controls with unique number 0 indexed

$(".slider").rotator({arrows:{left:".leftArrow",right:".rightArrow"}});

arrows is an object containing class identifiers for the left and right arrow DOM objects.

Default: {left:".leftArrow"+i,right:".rightArrow"+i} Where i is the 0 based increment of the number of sliders on the page.

tranSpeed

Description: The time a transition should last in milliseconds

$(".slider").rotator({tranSpeed:400});

Default: 800

delay

Description: The time a child should display before the transition in milliseconds

$(".slider").rotator({delay:10000});

Default: 4000

auto

Description: Sets auto scrolling through rotator. true starts animation automatically. false disables auto rotating

$(".slider").rotator({auto:false});

Default: true

loop

Description: Infinite scroll on or off, default true infinitely loops

$(".slider").rotator({loop:false});

If set to false the slider will scroll back to the 0 index when it has reached the last child

Default: true

backwards

Description: Sets the rotator to run backwards. Loop must be set to true to run backwards

$(".slider").rotator({backwards:false});

The rotator will rotate from left to right instead of right to left by default

Default: false

onChange

Description: onChange event fires when the transition animation begins

$(".slider").rotator({onChange:function(i){alert('next')}});

When the onChange event is fired a parameter is passed containing the new index of the rotator

Default: function(){}

endChange

Description: endChange event fires when the transition animation ends

$(".slider").rotator({endChange:function(i){alert('next')}});

When the endChange event is fired a parameter is passed containing the new index of the rotator

Default: function(){}

About

A configurable rotator plugin for jQuery

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published