I currently use the following function which checks the three params to see if there are any passed through, is this the best way to do this whilst setting a default if no parameter has been sent?
function setupSlideshow(t, e, s) {
e = e || '.slideshow';
s = s || '> li';
t = t || 70;
$timeout(function() {
$(e).cycle({
swipe: true,
slides: s,
fx: 'scrollHorz',
pager: '.cycle-pager',
timeout: 0
});
}, t);
}
By using setupSlideshow(70); this sets my timeout to 70ms but when it comes to setting the element then using setupSlideshow('.new-slideshow'); doesn't work.
setupSlideshow(70);
setupSlideshow('.new-slideshow');
setupSlideshow('.new-slideshow','.slide');