Using: drupal 7.
In CSS of my theme, the "body" element has a "padding-top" value as this:
body {
padding-top: 2em;
}This leads to two side-effects wtih this (great) module.
1st side-effect: when the banner is shown in the top, there's a gap between the top of the page and the banner itself, as shown here:

this is a trascurable side-effect and some could say "it's not a bug it's a feature", so I fully accept it. :-)
The second side-effect is that, when I click on a "deny" button ("no, grazie" == "no, thanks") both in a opt-in or opt-out mode, this is the result:

The #sliding-popup element is placed on top: -111px; but since there's a padding-top of 2em, -111px is not enough and the last line is still shown. And the gap between the last line and the body, is never hidden (until the next page visit).
Now, since I cannot remove that padding-top setting for the body element without problems around all the theme, I need a solution to really hide the #sliding-popup element after clicking the "no, thanks" button.
At the moment, the only workaround I found is to patch the eu_cookie_compliance.js script, adding a "location.reload()" in the Drupal.eu_cookie_compliance.declineAction function, line 255. Something like this:
Drupal.eu_cookie_compliance.declineAction = function () {
Drupal.eu_cookie_compliance.setStatus(0);
let popup = $('#sliding-popup');
if (popup.hasClass('sliding-popup-top')) {
popup.animate({ top: popup.outerHeight() * -1 }).trigger('eu_cookie_compliance_popup_close');
location.reload();
}
[...]And it works - I mean: the sliding-popup is still shown "too low" but since a page reload is forced, it's no more rendered. I think the same thing happens when I click on the "I agree" button (same problem with the position.. but as far as I can see, a reload is forced after a status change).
I understand this is just a temporary workaround, maybe somebody can find a better way to solve [my|this] problem?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | eu_cookie_compliance-body-top-padding-not-computed-2985986-4-8.x.patch | 8.92 KB | svenryen |
| #4 | eu_cookie_compliance-body-top-padding-not-computed-2985986-4-7.x.patch | 9.87 KB | svenryen |
| eu02.jpg | 386.93 KB | francoud | |
| EU01.jpg | 444.49 KB | francoud |
Comments
Comment #2
svenryen commentedI'll take a look. Right now there's quite a lot on my plate for this module, so patches are also welcome.
Comment #3
francoud commentedThanks 2svenryen, great job. Tell me if I can help with further information about this problem :)
Comment #4
svenryen commentedHi @francoud - I finally got around to looking into your report.
Not only did I have to consider padding-top, also margin-top (in your case 0) had to be added to the calculations.
You can upgrade now to the -dev version, or wait for 7.30.
Comment #7
svenryen commented