Tagged: ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1282012

    Dear friends at the Enfold-support-team,
    I would like to show only the cookie badge when the page loads for the first time, not the entire banner. The cookie-banner should only be displayed when you click on the badge. Is that possible? At the moment the banner is always loaded and only when a selection has been made it is replaced by the badge and the banner can be opened again. Can I change this behaviour?
    Would be glad to get an answer. Thanks a lot!

    #1282362

    Hey spooniverse,

    I’m not sure I understand exactly what you mean, could you post a link to your site and try to explain your intentions a bit further please?

    Best regards,
    Rikard

    #1282737

    Hey Rikard,

    normally the banner is always shown on first pageload. If you then make a selection whether cookies are allowed or not, the banner disappears. After that you can see the badge on the side and use it to display the banner again. I would like to only see the badge right from the start and display the banner using the badge as a toggle. The banner should not appear when the page is loaded until the visitor decides what to do, it should only be displayed via the badge. There is a css class added after the cookie decision. Perhaps, for example, you could add this beforehand so that you don’t just see the banner, as I said, but only show it via the badge.

    Can you understand it better like that? Thanks for your help!

    All the best,
    Daniel

    #1283454

    Hi,

    Thank you for the inquiry.

    We could use this css code to make the badge always visible.

    #av-cookie-consent-badge {
    	opacity: 0.7;
    	visibility: visible;
    }

    Then use this script to hide the message bar on initial load.

    // a custom script
    function ava_custom_script_mod() {
        if ( wp_script_is( 'avia-default', 'registered' ) ) {
            wp_add_inline_script( 'avia-default', '
    		(function($) {
    			$(document).ready(function() {
    				$(".avia-cookie-consent").addClass("cookiebar-hidden");
    			});
    		})(jQuery);
    	');
        }
     }
     add_action( 'wp_enqueue_scripts', 'ava_custom_script_mod', 9999);
    

    We have not tested this fully, so it might cause unintended privacy options behavior.

    Best regards,
    Ismael

    #1283505

    Perfect! Tested and tweaked it a little bit and it just works. Thank you.

    Any chance to hide the badge while the banner is opened?

    #1284354

    Added some CSS. Works for me.
    You can close this thread.
    Thanks again!

    #1284391

    Hi,

    You are very welcome! Glad we could be of help. Please feel free to open a new thread should you need anything else.

    Have a nice day.

    Best regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Cookie Badge’ is closed to new replies.