Methods and functions
Vegas provides methods to give you complete control on your slideshow and its options.
Method | Code | Description |
---|---|---|
play | $elmt.vegas('play'); | Start the slideshow. |
pause | $elmt.vegas('pause'); | Pause the slideshow. |
toggle | $elmt.vegas('toggle'); | Toggle play or pause. |
next | $elmt.vegas('next'); | Go to next slide. |
previous | $elmt.vegas('previous'); | Go to previous slide. |
jump | $elmt.vegas('jump', 3); | Go to a specific slide index. |
shuffle | $elmt.vegas('shuffle'); | Shuffle the slide array. |
playing | $elmt.vegas('playing'); | Return if the slideshow is playing/paused. |
current | $elmt.vegas('current'); | Return the current slide index. |
destroy | $elmt.vegas('destroy'); | Remove Vegas form the element. |
$('a#play').on('click', function () { $elmt.vegas('play'); });
$('a#pause').on('click', function () { $elmt.vegas('pause'); });
$('a#toggle').on('click', function () { $elmt.vegas('toggle'); });
$('a#next').on('click', function () { $elmt.vegas('next'); });
$('a#previous').on('click', function () { $elmt.vegas('previous'); });
$('a#shuffle').on('click', function () { $elmt.vegas('shuffle'); });
$('a#first').on('click', function () { $elmt.vegas('jump', 0); });
$('a#last').on('click', function () { $elmt.vegas('jump', 3); });
Options and settings can be changed on the fly.
Get an option value.
var transition = $elmt.vegas('options', 'transition');
var slides = $elmt.vegas('options', 'slides');
And so on...
Set an option value.
$elmt.vegas('options', 'transition', 'fade');
$elmt.vegas('options', 'slides', [ ... ]);
And so on...
Note that some options (preload overlay timer autoplay) can't be changed at runtime.
$elmt.vegas({ slides: [ { src: '/img/slide1.jpg' }, { src: '/img/slide2.jpg' } ], transition: 'slideLeft' }); $('a#previous').on('click', function () { $elmt.vegas('options', 'transition', 'slideRight2').vegas('previous'); }); $('a#next').on('click', function () { $elmt.vegas('options', 'transition', 'slideLeft2').vegas('next'); }); $('a#add').on('click', function () { var slides = $elmt.vegas('options', 'slides'); slides.push({ src:'/img/new-slide.jpg' }); $elmt .vegas('options', 'slides', slides) .vegas('options', 'transition', 'slideDown') .vegas('jump', slides.length - 1) .vegas('options', 'transition', 'slideLeft2'); });
Don't waste your precious time, support is available for 24$. Ask your question and quickly receive a ZIP file with a clear running example with commented code and assets solving your problem.
Ask for Support