}
// Dispatch an event if the slide changed
- if( indexh !== indexhBefore || indexv !== indexvBefore ) {
+ var slideChanged = (indexh !== indexhBefore || indexv !== indexvBefore);
+ if( slideChanged ) {
dispatchEvent( 'slidechanged', {
'indexh': indexh,
'indexv': indexv,
}
// Handle embedded content
- stopEmbeddedContent( previousSlide );
- startEmbeddedContent( currentSlide );
+ if (slideChanged) {
+ stopEmbeddedContent( previousSlide );
+ startEmbeddedContent( currentSlide );
+ }
updateControls();
updateProgress();