Skip to content

Commit

Permalink
Support data-transition-duration attributes for step elements.
Browse files Browse the repository at this point in the history
If the next element has its own data-transition-duration attribute,
use that value instead of the global setting.

References:
impress#142
  • Loading branch information
henrikingo committed Oct 21, 2017
1 parent 7f4832e commit a4197b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion js/impress.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@
z: lib.util.toNumber( data.rotateZ || data.rotate )
},
scale: lib.util.toNumber( data.scale, 1 ),
transitionDuration: lib.util.toNumber(
data.transitionDuration, config.transitionDuration
),
el: el
};

Expand Down Expand Up @@ -311,7 +314,7 @@
minScale: lib.util.toNumber( rootData.minScale, defaults.minScale ),
perspective: lib.util.toNumber( rootData.perspective, defaults.perspective ),
transitionDuration: lib.util.toNumber(
rootData.transitionDuration, defaults.transitionDuration
rootData.transitionDuration, defaults.transitionDuration
)
};

Expand Down Expand Up @@ -416,6 +419,7 @@
window.scrollTo( 0, 0 );

var step = stepsData[ "impress-" + el.id ];
duration = ( duration !== undefined ? duration : step.transitionDuration );

// If we are in fact moving to another step, start with executing the registered
// preStepLeave plugins.
Expand Down
6 changes: 5 additions & 1 deletion src/impress.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@
z: lib.util.toNumber( data.rotateZ || data.rotate )
},
scale: lib.util.toNumber( data.scale, 1 ),
transitionDuration: lib.util.toNumber(
data.transitionDuration, config.transitionDuration
),
el: el
};

Expand Down Expand Up @@ -311,7 +314,7 @@
minScale: lib.util.toNumber( rootData.minScale, defaults.minScale ),
perspective: lib.util.toNumber( rootData.perspective, defaults.perspective ),
transitionDuration: lib.util.toNumber(
rootData.transitionDuration, defaults.transitionDuration
rootData.transitionDuration, defaults.transitionDuration
)
};

Expand Down Expand Up @@ -416,6 +419,7 @@
window.scrollTo( 0, 0 );

var step = stepsData[ "impress-" + el.id ];
duration = ( duration !== undefined ? duration : step.transitionDuration );

// If we are in fact moving to another step, start with executing the registered
// preStepLeave plugins.
Expand Down

0 comments on commit a4197b1

Please sign in to comment.