* feat: set up an event handler that will allow close the banner and set a cookie when you've closed it * feat: return early if the cookie says it shouldn't be shown * refactor: make the names more general so that they can be applied to other campaigns
13 lines
332 B
JavaScript
13 lines
332 B
JavaScript
'use strict';
|
|
|
|
function initializeHeroBannerClose() {
|
|
let banner = document.getElementById("js-hero-banner");
|
|
let closeIcon = document.getElementById("js-hero-banner__x");
|
|
|
|
if (banner && closeIcon) {
|
|
closeIcon.onclick = (e) => {
|
|
document.cookie = "heroBanner=false";
|
|
banner.style.display = "none";
|
|
}
|
|
}
|
|
}
|