Skip to content

Commit

Permalink
Steps are now given the transform-style preserve-3d property along wi…
Browse files Browse the repository at this point in the history
…th the canvas in supporting browsers
  • Loading branch information
IanLunn committed Apr 24, 2015
1 parent 0cf912f commit d289ba3
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 16 deletions.
35 changes: 28 additions & 7 deletions scripts/sequence.js
Expand Up @@ -958,19 +958,40 @@ function defineSequence(imagesLoaded, Hammer) {
self.$screen.style.width = "100%";
}

// if moveActiveStepToTop is enabled and the browser supports
// transform-style: preserve-3d, add this property to the canvas.
// This enables the use of transform: translateZ() in favor of z-index
// to work around a bug in iOS browsers
if (self.options.moveActiveStepToTop === true && self.propertySupport.transformStylePreserve3d === true) {
self.$canvas.style[Modernizr.prefixed("transformStyle")] = "preserve-3d";
}
self.canvas.addPreserve3d();

// Determine the position of each step and the transform properties
// required for the canvas so it can move to each step
self.canvas.getTransformProperties();
},

/**
* if moveActiveStepToTop is enabled and the browser supports
* transform-style: preserve-3d, add this property to the canvas and steps.
* This enables the use of transform: translateZ() in favor of z-index
* to work around a bug in iOS browsers
*
* @api private
*/
addPreserve3d: function() {

if (self.options.moveActiveStepToTop === true && self.propertySupport.transformStylePreserve3d === true) {

var i,
$step;

// Add to the canvas
self.$canvas.style[Modernizr.prefixed("transformStyle")] = "preserve-3d";

// Add to the steps
for (i = 0; i < self.noOfSteps; i++) {

$step = self.$steps[i];
$step.style[Modernizr.prefixed("transformStyle")] = "preserve-3d";
}
}
},

/**
* Get Sequence's steps
*
Expand Down
2 changes: 1 addition & 1 deletion scripts/sequence.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/sequence.min.map

Large diffs are not rendered by default.

35 changes: 28 additions & 7 deletions src/sequence.js
Expand Up @@ -958,19 +958,40 @@ function defineSequence(imagesLoaded, Hammer) {
self.$screen.style.width = "100%";
}

// if moveActiveStepToTop is enabled and the browser supports
// transform-style: preserve-3d, add this property to the canvas.
// This enables the use of transform: translateZ() in favor of z-index
// to work around a bug in iOS browsers
if (self.options.moveActiveStepToTop === true && self.propertySupport.transformStylePreserve3d === true) {
self.$canvas.style[Modernizr.prefixed("transformStyle")] = "preserve-3d";
}
self.canvas.addPreserve3d();

// Determine the position of each step and the transform properties
// required for the canvas so it can move to each step
self.canvas.getTransformProperties();
},

/**
* if moveActiveStepToTop is enabled and the browser supports
* transform-style: preserve-3d, add this property to the canvas and steps.
* This enables the use of transform: translateZ() in favor of z-index
* to work around a bug in iOS browsers
*
* @api private
*/
addPreserve3d: function() {

if (self.options.moveActiveStepToTop === true && self.propertySupport.transformStylePreserve3d === true) {

var i,
$step;

// Add to the canvas
self.$canvas.style[Modernizr.prefixed("transformStyle")] = "preserve-3d";

// Add to the steps
for (i = 0; i < self.noOfSteps; i++) {

$step = self.$steps[i];
$step.style[Modernizr.prefixed("transformStyle")] = "preserve-3d";
}
}
},

/**
* Get Sequence's steps
*
Expand Down

0 comments on commit d289ba3

Please sign in to comment.