Last active
April 15, 2019 11:26
-
-
Save karimal/40040f855b4612bd32397edac67db50c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Variation 1 > will show old banner | |
- JS | |
/* CUSTOM CODE */ | |
var shouldShowBar = JSON.parse(localStorage.getItem('COOKIES_BAR__SHOW')) !== 'no' ; | |
if (shouldShowBar) { | |
setTimeout(function() { | |
document.getElementsByClassName('testCookiesBar')[0].remove(); | |
var event = document.createEvent('Event'); | |
event.initEvent('updateOffset', true, true); | |
document.dispatchEvent(event); | |
}, 100); | |
} | |
---------------------------------------------------------------------------------- | |
// Variation 2 > will show new banner | |
- CSS | |
.originalCookiesBar { | |
display: none !important; | |
} | |
- JS | |
/* CUSTOM CODE */ | |
var shouldShowBar = JSON.parse(localStorage.getItem('COOKIES_BAR__SHOW')) !== 'no' ; | |
if (shouldShowBar) { | |
setTimeout(function() { | |
document.getElementsByClassName('originalCookiesBar')[0].remove(); | |
document.getElementsByClassName('testCookiesBar')[0].style.display = 'block'; | |
var event = document.createEvent('Event'); | |
event.initEvent('updateOffset', true, true); | |
document.dispatchEvent(event); | |
}, 100); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment