From ececa37bf3f98ffc93babd5f7142ea409acc7585 Mon Sep 17 00:00:00 2001 From: Amauri CHAMPEAUX Date: Tue, 16 Feb 2021 10:46:34 +0100 Subject: [PATCH] Put CSS on the .css file and set onclick as an event #572 --- css/tarteaucitron.css | 9 +++++++++ tarteaucitron.js | 13 ++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/css/tarteaucitron.css b/css/tarteaucitron.css index 45e9f1b..cc3cd78 100644 --- a/css/tarteaucitron.css +++ b/css/tarteaucitron.css @@ -869,6 +869,15 @@ span.tarteaucitronTitle.tarteaucitronH3 { margin-top: 12px!important; } +#tarteaucitronCloseCross { + position:absolute; + color: #FFFF; + font-size:1.8rem; + cursor: pointer; + top: 10px; + right: 26px +} + .spacer-20 { height: 20px; display: block; diff --git a/tarteaucitron.js b/tarteaucitron.js index 7619e9e..2e0d9e0 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -582,12 +582,8 @@ var tarteaucitron = { 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") + span.setAttribute('id', "tarteaucitronCloseCross") element.insertBefore(span, element.firstElementChild) - document.getElementById("clossCross").onclick = () =>{ - tarteaucitron.userInterface.closeAlert(); - } } @@ -596,6 +592,9 @@ var tarteaucitron = { setTimeout(function () { // Setup events + tarteaucitron.addClickEventToId("tarteaucitronCloseCross", function () { + tarteaucitron.userInterface.closeAlert(); + }); tarteaucitron.addClickEventToId("tarteaucitronPersonalize", function () { tarteaucitron.userInterface.openPanel(); }); @@ -872,11 +871,11 @@ var tarteaucitron = { index = 0; for (index = 0; index < tarteaucitron.job.length; index += 1) { - + if (typeof type !== 'undefined' && s[tarteaucitron.job[index]].type !== type) { continue; } - + service = s[tarteaucitron.job[index]]; key = service.key; if (tarteaucitron.state[key] !== status) {