parallax-react-js
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -12,14 +12,13 @@ import React from 'react'; | ||
var _a; | ||
if (!props.speed) | ||
props.speed = "100%"; //if props.speed is undefined set it to 100% (normal scroll speed) | ||
var speed = props.speed ? props.speed : "100%"; //if props.speed is undefined set it to 100% (normal scroll speed) | ||
//check if props.speed is a proper percentage. If not throw an error and set props.speed to 100% again | ||
if (!props.speed.includes("%")) { | ||
if (!speed.includes("%")) { | ||
console.error("Value of Parallax Speed must be a percentage. Read our documentation for further information."); | ||
props.speed = "100%"; | ||
speed = "100%"; | ||
} | ||
(_a = thisdiv.current) === null || _a === void 0 ? void 0 : _a.setAttribute("parallaxSpeed", props.speed); | ||
(_a = thisdiv.current) === null || _a === void 0 ? void 0 : _a.setAttribute("parallaxSpeed", speed); | ||
//set attribute "parallaxSpeed" of the div to the same value as props.speed. | ||
//This way you can see the value in the actual dom. | ||
//You can also change it and directly influence the scroll speed without changing your source code. | ||
}, [props.speed]); //Only run the checks on props.speed again if it has changed. | ||
}); | ||
//Render chldren of this ParallaxLayer inside of a wrapper div which is part of the "Parallax-Layer" class. | ||
@@ -26,0 +25,0 @@ //Wrapper div is referenced by the "thisdiv" ("thisdivprefetch") reference so parallaxSpeed can be set properly. |
{ | ||
"name": "parallax-react-js", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A libary for managing scroll speed of different components in react.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14165
96