ponysmith.github.io

shyftPublic Methods

Public Methods

When you instantiate a carousel using shyft(), the function call returns an object which exposes several public methods for interacting with and modifying the carousel. The methods can be called by storing the returned object in a variable and calling the appropriate method from that object. The available public methods and simple examples can be found below.

.change( delta [, anim [, nostop]] )

Triggers a slide change.

Arguments

1
2
3
4
5
6
// Store the return object in a variable
var myshyft = shyft($('#myshyft'));
// Change to next slide
myshyft.change('+');
// Change to slide 3, set easing, and prevent stop
myshyft.change(3, 'easeOutExpo', true);

.destroy( nocallback )

Destroys the shyft carousel and returns the DOM to its original state.

Arguments

1
2
3
4
// Store the return object in a variable
var myshyft = shyft($('#myshyft'));
// Destroy the carousel
myshyft.destroy();

.update( options )

Destroys and rebuilds the carousel using any new options passed in via the options argument

Arguments

1
2
3
4
5
// Store the return object in a variable
var myshyft = shyft($('#myshyft'));
// Update with new options
var newopts = { nav: false, autoplay: true }
myshyft.update(newopts);

.add( slide [, index [, focus]] )

Adds a new slide to the carousel

Arguments

1
2
3
4
5
6
// Store the return object in a variable
var myshyft = shyft($('#myshyft'));
// Create a jquery object for the slide
var slide = $('<img src="my/new/image.jpg" />');
// Add the slide to position 3 and focus it immediately
myshyft.add(slide, 3, true);

.remove( index )

Removes a slide from the carousel. After removing the slide, if there are no remaining slides in the carousel, the carousel will automatically be destroyed. Adding a slide back into the carousel with add() will automatically update and rebuild the carousel.

Arguments

1
2
3
4
// Store the return object in a variable
var myshyft = shyft($('#myshyft'));
// Remove the third slide
myshyft.remove(3);

.play()

Resumes playing the slideshow if paused. Note that play() will only work if the slideshow is paused. If the slideshow is stopped, you will need to use start() instead.

1
2
3
// Store the return object in a variable
var myshyft = shyft($('#myshyft'));
myshyft.play();

.pause()

Pauses the slideshow. This only pauses the slideshow, so it can be restarted with play(). If you want to stop the slideshow completely, use stop()

1
2
3
// Store the return object in a variable
var myshyft = shyft($('#myshyft'));
myshyft.pause();

.start()

Starts the slideshow. This is the only way to start the slideshow if it has been stopped.

1
2
3
// Store the return object in a variable
var myshyft = shyft($('#myshyft'));
myshyft.start();

.stop()

Completely stops the slideshow. To start the slideshow once it has been stopped, you must use start().

1
2
3
// Store the return object in a variable
var myshyft = shyft($('#myshyft'));
myshyft.stop();