// dependency: https://github.com/js-cookie/js-cookie
// wait for the document to load
window.onload = function() {
// aaand wait a bit more
setTimeout( function(){
// set variables for the dom element & the cookie
var myElementlogo = document.querySelector("#myID");
var cookieExists = Cookies.get('logoHider');
// check weather cookie exhists and if yes, then hide the logo
if (!cookieExists) {
myElement.classList.remove("hide");
// eventlistener alternative method for backward compatibility (IE < 9)
logo.onclick =
function hideElement() {
myElement.classList.add("hide");
Cookies.set('elementHider', 'yes', { expires: 1, path: '', domain: '.mydomain.com' });
}
// initial method i used, but not suitable for older browser
// addEventListener('click', hideElement, false);
} else if (cookieExists) {
myElement.classList.add("hide");
}
}, 100);
};