When running in debug mode, the scroll liteneris always added regardless of weather the acceptOnScroll was set to true or false

This commit is contained in:
Ahmad Game 2019-06-27 11:30:43 +02:00
parent 98b401dc72
commit f7a98c925d

View File

@ -66,8 +66,8 @@ class CookieConsent extends Component {
this.setState({ visible: true });
}
// if acceptOnScroll is set to true and cookie is undefined or debug is set to true, add a listener.
if ((this.props.acceptOnScroll && Cookies.get(cookieName) === undefined) || debug) {
// if acceptOnScroll is set to true and (cookie is undefined or debug is set to true), add a listener.
if (this.props.acceptOnScroll && (Cookies.get(cookieName) === undefined || debug)) {
window.addEventListener("scroll", this.handleScroll, { passive: true });
}
}