From f6265b7f8995804c64d2ea4bb1dfa52ef25002d2 Mon Sep 17 00:00:00 2001 From: Luca Rosaldi Date: Fri, 10 Jul 2020 18:14:47 +0200 Subject: [PATCH] add option to use inline styles for positioning --- src/parallax.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/parallax.js b/src/parallax.js index 3c345b3..c63c4be 100644 --- a/src/parallax.js +++ b/src/parallax.js @@ -149,7 +149,8 @@ const MAGIC_NUMBER = 30, pointerEvents: false, precision: 1, onReady: null, - selector: null + selector: null, + useInlinePosition: true } class Parallax { @@ -302,10 +303,12 @@ class Parallax { helpers.accelerate(layer) } - layer.style.position = index ? 'absolute' : 'relative' - layer.style.display = 'block' - layer.style.left = 0 - layer.style.top = 0 + if (this.useInlinePosition) { + layer.style.position = index ? 'absolute' : 'relative' + layer.style.display = 'block' + layer.style.left = 0 + layer.style.top = 0 + } let depth = helpers.data(layer, 'depth') || 0 this.depthsX.push(helpers.data(layer, 'depth-x') || depth)