Tagged: , ,

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #452256

    Hi Kriesi,

    I’m using the plugin ‘Cookie Law info’ which has to be a sticky bar at the header.
    Because the header of the enfold template is a sticky bar too, there is a conflict.
    You can see it at this page: http://www.c-testing.nl/ccom/

    The cookie bar isn’t sticky anymore, and there appears a padding at the top of the theme header.

    How can I set these two to be sticky at the same time?

    Thanks in advance.

    Greets Mark

    #452387

    Hey Mark_goessens!

    I’m not familiar with that plugin, would it be possible to set it to display at the bottom of the page instead?

    Cheers!
    Rikard

    #452487

    Hi Rikard,

    It’s possible to place the sticky bar at the bottom of the page. But I prefer to place it at the top.
    Because at the bottom is will be placed over the content instead of beneath the content.
    But I was wondering if it was a template issue that a sticky bar at the top won’t act ‘sticky’ when there is allready another sticky header?

    Greets Mark

    #452512

    Hi!

    Please add following code to Quick CSS in Enfold theme options under General Styling tab

    div#cookie-law-info-bar {
      position: fixed;
    }

    Regards,
    Yigit

    #452513

    Hi Yigit,

    Thanks. I allready tried that. The sticky headers are both sticky now.
    But the cookie policy bar show up in front of the Enfold header.
    I could add margin-top to move the Enfold header down, but when the cookies are accepted, the enfold header has to be at the absolute top again.

    Greets Mark

    #452523

    Hi!

    Please try adding following code to Functions.php file in Appearance > Editor

    function add_custom_header(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('a#cookie_action_close_header').click(function(){
    jQuery('#header').addClass('agreed');
    });
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_header');

    and then add following code to Quick CSS

    #header {
      top: 50px;
    }
    #header.agreed {
      top: 0!important;
    }

    Best regards,
    Yigit

    #452532

    Now the bars are looking good. But the cookie law header isn’t sticky anymore when I start scrolling.

    Can you see what happens?

    #452534

    Hey!

    Please keep this code in Quick CSS as well – https://kriesi.at/support/topic/sticky-cookie-law-bar/#post-452512

    Best regards,
    Yigit

    #452548

    Of course! My fault. Thanks.
    This is working very good now!

    Greets Mark

    #452555

    I’m sorry, I saw another thing that doesn’t work.

    When I click on ‘accepteer cookies’ (translate: ‘accept cookies’) the cookie bar disappears. And the header is at the absolutely top now.
    That’s good. But then when I refresh the page again, I see that the enfold header is not at the top anymore but any pixels lower.

    Can I change that somewhere?

    #453016

    Hi!

    Try to use this code in the functions.php file:

    add_action('wp_footer', 'ava_custom_script', 10);
    function ava_custom_script(){
    ?>
    <script>
    (function($){
      var cookie = $('a#cookie_action_close_header').length;
      if ( cookie ) {
        $('#header').css('top', '50px');
      }
    }(jQuery));
    </script>
    <?php
    }

    Cheers!
    Ismael

    #453024

    Hi Ismael,

    Do I have to delete the other code at functions.php Yigit gave me?
    I tried both options (with and without the code of Yigit). Both doesn’t solve the problem.

    This is the code in my functions.php:

    function add_custom_header(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery('a#cookie_action_close_header').click(function(){
    jQuery('#header').addClass('agreed');
    });
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_header');
    
    add_action('wp_footer', 'ava_custom_script', 10);
    function ava_custom_script(){
    ?>
    <script>
    (function($){
      var cookie = $('a#cookie_action_close_header').length;
      if ( cookie ) {
        $('#header').css('top', '50px');
      }
    }(jQuery));
    </script>
    <?php
    }
    #453266

    Hey!

    You should remove my code and try the one Ismael posted. If that too does not help, please create a temporary admin login and post credentials here privately.

    Best regards,
    Yigit

    #454993
    This reply has been marked as private.
    #455415

    Hi!

    Alright. Please check it now. Test it with or without the cookie: http://www.c-testing.nl/ccom/

    Wait for the page to finish loading.

    Best regards,
    Ismael

    #455786

    Hi Ismael,

    Now it works like I inspected! Thanks a lot for your help!

    Greets Mark

Viewing 16 posts - 1 through 16 (of 16 total)

The topic ‘Sticky Cookie Law bar’ is closed to new replies.