William Ortega ← PhotoSwipe Feedback Forum My feedback autoplay 34 votes Vote Vote Vote Vote We're glad you're herePlease sign in to leave feedback Signed in as (Sign out) Close Close 1 vote 2 votes 3 votes Remove votes You have left! (?) (thinking…) 4 comments · Feature Requests & Ideas · Flag idea as inappropriate…Flag idea as inappropriate… · Delete… · Admin → How important is this to you? Not at all You must login first! Important You must login first! Critical You must login first! We're glad you're herePlease sign in to leave feedback Signed in as (Sign out) Close Close An error occurred while saving the comment William Ortega commented · January 22, 2015 · Edit… · Delete… I add this option with jQuery: /** JS **/ gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); if ($('.pswp__button--autoplay').length === 0) $('<button class="pswp__button pswp__button--autoplay" title="AutoPlay"></button>').insertAfter('.pswp__button--zoom'); var _autoplayId = null; $('.pswp__button--autoplay').on('click', function(event) { event.preventDefault(); if (_autoplayId) { clearInterval(_autoplayId); _autoplayId = null; $('.pswp__button--autoplay').removeClass('stop'); } else { _autoplayId = setInterval(function() { gallery.next(); }, 3000); $('.pswp__button--autoplay').addClass('stop'); } }); /** CSS **/ .pswp__button--autoplay { background: transparent url(play_icon.png) no-repeat scroll 16px 16px !important; } .pswp__button--autoplay.stop { background-image: url(stop_icon.png) !important; } Save Submitting...
I add this option with jQuery:
/** JS **/
gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
if ($('.pswp__button--autoplay').length === 0)
$('<button class="pswp__button pswp__button--autoplay" title="AutoPlay"></button>').insertAfter('.pswp__button--zoom');
var _autoplayId = null;
$('.pswp__button--autoplay').on('click', function(event) {
event.preventDefault();
if (_autoplayId) {
clearInterval(_autoplayId);
_autoplayId = null;
$('.pswp__button--autoplay').removeClass('stop');
} else {
_autoplayId = setInterval(function() { gallery.next(); }, 3000);
$('.pswp__button--autoplay').addClass('stop');
}
});
/** CSS **/
.pswp__button--autoplay {
background: transparent url(play_icon.png) no-repeat scroll 16px 16px !important;
}
.pswp__button--autoplay.stop {
background-image: url(stop_icon.png) !important;
}