From 94319d06462dd5b3dccf5310af3daa4bbdb29196 Mon Sep 17 00:00:00 2001 From: Amauri CHAMPEAUX Date: Fri, 13 Apr 2018 09:08:24 +0200 Subject: [PATCH] Open the cookie manager with a class name on a link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bonne idée 👍 https://github.com/AmauriC/tarteaucitron.js/issues/59 Pour faciliter les choses, c'est possible en ajoutant une class à un lien : `Cookies` --- tarteaucitron.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tarteaucitron.js b/tarteaucitron.js index baae827..f3cfc1d 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -33,8 +33,9 @@ var tarteaucitron = { window.addEventListener("load", function () { tarteaucitron.load(); tarteaucitron.fallback(['tarteaucitronOpenPanel'], function (elem) { - elem.addEventListener("click", function () { + elem.addEventListener("click", function (event) { tarteaucitron.userInterface.openPanel(); + event.preventDefault(); }, false); }, true); }, false); @@ -87,8 +88,9 @@ var tarteaucitron = { window.attachEvent("onload", function () { tarteaucitron.load(); tarteaucitron.fallback(['tarteaucitronOpenPanel'], function (elem) { - elem.attachEvent("onclick", function () { + elem.attachEvent("onclick", function (event) { tarteaucitron.userInterface.openPanel(); + event.preventDefault(); }); }, true); });