• Resolved timmy321

    (@timmy321)


    Hi,

    I’ve searched through here for an answer to this but can’t find one.

    I’ve activated the accept on scroll option, which works great.

    Is there also a way to accept cookies if the user clicks onto another page? I notice the cookie bar remains when navigating through the site unless the user scrolls down.

    Kind regards,

    Tim

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @timmy321,

    Please try adding below code snippet to your active theme’s functions.php

    add_action('wp_footer','accept_onclick',20);
        function accept_onclick()
        {
            if(!isset($_COOKIE['viewed_cookie_policy']) && class_exists('Cookie_Law_Info_Public'))
            {
            ?>
            <script>
                jQuery('body').click(function(e) {
                    if(!jQuery('body').hasClass('cli-consent-accepted'))
                    {   
                        jQuery('body').addClass('cli-consent-accepted');
                        jQuery('.cli_action_button[data-cli_action=accept]').trigger('click');
                    }
                });
                jQuery('#cookie-law-info-bar, .cli-modal-dialog').on('click',function(e){
                        e.stopPropagation();
                    });
            </script>
            <?php
            }
        }
    Thread Starter timmy321

    (@timmy321)

    Hi @webtoffee

    Excellent stuff, worked a treat. Thank you very much!

    All the best.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Accept cookies by clicking onto another page as well as by scroll?’ is closed to new replies.