Adding and Overriding Transitions
Edgar Gonzalez edited this page Feb 5, 2012
·
7 revisions
You can add your custom image transitions, flash transitions and flash to image transitions to a slider upon initalization.
To do this, you will need to specify one of the corresponding options, like this:
$(window).load(function(){
$('#slider').ramblingSlider({
imageTransitions: {
newImageTransitionName: function() {
/* ... */
},
otherTransition: function() {
/* ... */
}
/* ... */
},
flashTransitions: {
/* Same format */
},
imageFlashTransitions: {
/* Same format */
}
});
});
You can then set your custom transition to be called with:
$('#slider').ramblingSlider('effect', 'newImageTransitionName')
Or just leave the default (random
) and it will be used eventually.
To override any transition, just be sure that the name of the new transition is the same as the one you are trying to override. For example:
$(window).load(function(){
$('#slider').ramblingSlider({
imageTransitions: {
boxRandom: function() {
/* Override the default boxRandom transition */
}
}
});
});
When the new transition functions added are called, they will have these functions available on this
:
-
createSlices
. Returnssettings.slices
number of slices, ready to apply any animation. -
createBoxes
. Returnssettings.boxRows * settings.boxCols
number of boxes, ready to apply any animation. -
getOneSlice
. Returns one slice, ready to appy any animation. -
animateFullImage
. Expects ananimationSetUp
callback, which will have the full image jQuery element asthis
and the slider and settings parameters, that should execute any action that needs to be done before running the animation and then return the parameters to be passed to the jQueryanimate
method. -
animateSlices
. Expects ananimationSetUp
callback, which will have each slice jQuery element asthis
, and that should execute any action that needs to be done before running the animation and then return the parameters to be passed to the jQueryanimate
method, and asortCallback
, with all the slices jQuery collection asthis
and that is expected to sort thesettings.slices
number of slices. -
animateBoxes
. Expects ananimationCallback
to be applied to the boxes, and asortCallback
to sort thesettings.boxRows * settings.boxCols
number of boxes. Also, passes thefinishedCallback
to theanimationCallback
function, expecting it to be raised when the whole animation is finished. -
slideUpSlices
. Expects only asortCallback
, with all the slices jQuery collection asthis
and that is expected to sort thesettings.slices
number of slices. -
slideDownSlices
. Expects only asortCallback
, with all the slices jQuery collection asthis
and that is expected to sort thesettings.slices
number of slices. -
slideUpDownSlices
. Expects only asortCallback
, with all the slices jQuery collection asthis
and that is expected to sort thesettings.slices
number of slices. -
foldSlices
. Expects only asortCallback
, with all the slices jQuery collection asthis
and that is expected to sort thesettings.slices
number of slices. -
fadeSlices
. Expects only asortCallback
, with all the slices jQuery collection asthis
and that is expected to sort thesettings.slices
number of slices. -
fadeBoxes
. Expects only asortCallback
, with all the slices jQuery collection asthis
and that is expected to sort thesettings.slices
number of slices. -
rainBoxes
. Expects asortCallback
, with all the boxes jQuery collection asthis
and that is expected to sort thesettings.boxRows * settings.boxCols
number of boxes, and agrow
boolean to determine if using the fade or grow box effect.