|
@@ -122,6 +122,8 @@ var Reveal = (function(){
|
|
|
previousSlide,
|
|
|
currentSlide,
|
|
|
|
|
|
+ previousBackgroundHash,
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -442,6 +444,7 @@ var Reveal = (function(){
|
|
|
};
|
|
|
|
|
|
var element = document.createElement( 'div' );
|
|
|
+ element.setAttribute( 'data-background-hash', data.background + data.backgroundSize + data.backgroundImage + data.backgroundColor + data.backgroundRepeat + data.backgroundPosition + data.backgroundTransition );
|
|
|
element.className = 'slide-background';
|
|
|
|
|
|
if( data.background ) {
|
|
@@ -1891,24 +1894,63 @@ var Reveal = (function(){
|
|
|
*/
|
|
|
function updateBackground() {
|
|
|
|
|
|
+ var currentBackground = null;
|
|
|
+
|
|
|
+
|
|
|
+ var horizontalPast = config.rtl ? 'future' : 'past',
|
|
|
+ horizontalFuture = config.rtl ? 'past' : 'future';
|
|
|
+
|
|
|
|
|
|
|
|
|
toArray( dom.background.childNodes ).forEach( function( backgroundh, h ) {
|
|
|
|
|
|
-
|
|
|
- var horizontalPast = config.rtl ? 'future' : 'past',
|
|
|
- horizontalFuture = config.rtl ? 'past' : 'future';
|
|
|
+ backgroundh.className = 'slide-background ';
|
|
|
|
|
|
- backgroundh.className = 'slide-background ' + ( h < indexh ? horizontalPast : h > indexh ? horizontalFuture : 'present' );
|
|
|
+ if( h < indexh ) {
|
|
|
+ backgroundh.className += horizontalPast;
|
|
|
+ }
|
|
|
+ else if ( h > indexh ) {
|
|
|
+ backgroundh.className += horizontalFuture;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ backgroundh.className += 'present';
|
|
|
+
|
|
|
+
|
|
|
+ currentBackground = backgroundh;
|
|
|
+ }
|
|
|
|
|
|
toArray( backgroundh.childNodes ).forEach( function( backgroundv, v ) {
|
|
|
|
|
|
- backgroundv.className = 'slide-background ' + ( v < indexv ? 'past' : v > indexv ? 'future' : 'present' );
|
|
|
+ backgroundv.className = 'slide-background ';
|
|
|
+
|
|
|
+ if( v < indexv ) {
|
|
|
+ backgroundv.className += 'past';
|
|
|
+ }
|
|
|
+ else if ( v > indexv ) {
|
|
|
+ backgroundv.className += 'future';
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ backgroundv.className += 'present';
|
|
|
+
|
|
|
+
|
|
|
+ if( h === indexh ) currentBackground = backgroundv;
|
|
|
+ }
|
|
|
|
|
|
} );
|
|
|
|
|
|
} );
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ if( currentBackground ) {
|
|
|
+ var currentBackgroundHash = currentBackground.getAttribute( 'data-background-hash' );
|
|
|
+ if( currentBackgroundHash === previousBackgroundHash ) {
|
|
|
+ dom.background.classList.add( 'no-transition' );
|
|
|
+ }
|
|
|
+
|
|
|
+ previousBackgroundHash = currentBackgroundHash;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
setTimeout( function() {
|
|
|
dom.background.classList.remove( 'no-transition' );
|