• Resolved okieh

    (@okieh)


    Hi,

    I am experimenting a little bit with this awesome plugin. Has all features I need but one is missing. I have a really nice Head-Slider on my website, animated by myself and it only animates once. When the Cookie Banner directly appears it blocks the user from the awesome experience to see this ( xD ).

    So I tried implementing a (window).scroll(function)…to set a class that makes the banner visible only after first scroll of website. The problem is, then it also shows up again, even if the user already chose “accept all” or “deny all”.

    Is there a solution to show the cookie banner only when the user scrolled down e.g. 50px including showing it only when the user haven’t already chosen “accept all” or “deny all” (so it’s normal behavior)?

    I would be so grateful to get a solution here ?? Thank you

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor jarnovos

    (@jarnovos)

    Hi @okieh,

    Sure, I would be glad to help you achieve that result.

    You can use the snippet attached below by saving it as a .php file in the folder /wp-content/mu-plugins/ on your website, and it should work out of the box.

    I’ve set it to display the banner after at least 30% of the page has been scrolled, but you can change the value 30 (on line 19) to whichever scroll percentage at which point you would like the banner to appear.

    cmplz-delay-banner-scroll.php

    This is my example page with the above snippet applied: https://us-vulture-niko.instawp.xyz/sample-page/

    Kind regards, Jarno

    Thread Starter okieh

    (@okieh)

    Thank you very much! Can I achieve that also with something in my child-theme folder? Like something in the functions.php?

    And has the cookie banner some ‘fade in’ options? for this casenit would be smoother. Thanks.

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @okieh,

    Yes, you could add that snippet in functions.php instead (if you remove the opening <?php tag from the snippet on line 1).

    A Fade In effect can be enabled under Complianz -> Cookie Banner -> Appearance -> Animation.

    Kind regards, Jarno

    Thread Starter okieh

    (@okieh)

    Wow! Thank you! I didn’t need the percentage of the page and changed the if case to just “if (scrollTop > 50)” and it works like a charm.

    Thank you so much! ??

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @okieh,

    No problem, glad to hear that it works well for you!

    If you’re happy with the plugin and our support, it would be really great if you could consider casting a review about the plugin here: https://www.ads-software.com/support/plugin/complianz-gdpr/reviews/#new-post

    Kind regards, Jarno

    Thread Starter okieh

    (@okieh)

    Never Mind…was my fault – everything works great!

    except on custom pages where he does not display the cookie banner, then he throws the error:

    Uncaught TypeError: Cannot read properties of null (reading ‘classList’)

    • This reply was modified 1 year, 3 months ago by okieh.
    • This reply was modified 1 year, 3 months ago by okieh. Reason: Mistake made
    • This reply was modified 1 year, 3 months ago by okieh.
    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @okieh,

    Ah yes, you’re correct about the undefined error on pages without the Cookie Banner. The below version of the snippet will resolve this:

    cmplz-delay-banner-scroll.php

    Kind regards, Jarno

    Thread Starter okieh

    (@okieh)

    Wow! Big Thanks ?? I needed that and was to stupid to solve that myself <3

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Show Cookie Banner after Page Scroll’ is closed to new replies.