From e79d39946abc1448114b6c1068085f1de20e3b87 Mon Sep 17 00:00:00 2001 From: BuyukCem Date: Tue, 26 Jan 2021 13:53:51 +0100 Subject: [PATCH] include close popup cross --- css/tarteaucitron.css | 5 ----- tarteaucitron.js | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/css/tarteaucitron.css b/css/tarteaucitron.css index 26e92ac..45e9f1b 100644 --- a/css/tarteaucitron.css +++ b/css/tarteaucitron.css @@ -880,9 +880,4 @@ span.tarteaucitronTitle.tarteaucitronH3 { .display-none { display: none; -} -#tarteaucitronDisclaimerAlert:before { - position: relative; - content: "X"; - color: red; } \ No newline at end of file diff --git a/tarteaucitron.js b/tarteaucitron.js index e90acaf..737a38a 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -218,7 +218,8 @@ var tarteaucitron = { "privacyUrl": "", "useExternalCss": false, "useExternalJs": false, - "mandatory": true + "mandatory": true, + "closePopup": false }, params = tarteaucitron.parameters; @@ -277,7 +278,6 @@ var tarteaucitron = { } document.getElementsByTagName('head')[0].appendChild(customThemeMiddle); } - var body = document.body, div = document.createElement('div'), html = '', @@ -578,6 +578,19 @@ var tarteaucitron = { } }, 1500); } + if(tarteaucitron.parameters.closePopup === true){ + let element = document.getElementById('tarteaucitronAlertBig'); + let span = document.createElement('span') + span.textContent = 'X'; + span.style.cssText = 'position:absolute; color: #FFFF; font-size:2rem; cursor: pointer; top: 10px; right: 26px'; + span.setAttribute('id', "clossCross") + element.insertBefore(span, element.firstElementChild) + document.getElementById("clossCross").onclick = () =>{ + tarteaucitron.userInterface.closeAlert(); + } + } + + // add a little timeout to be sure everything is accessible setTimeout(function () {