Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #1018999

    Hi, i would like my header to change colour when you start to scroll, have you got code for this?

    #1019142

    Hey timchurchman,

    Please provide a link to the site page in question so we can look into this issue further.

    Best regards,
    Jordan Shannon

    #1020029
    #1020370

    Hi,

    Once you scroll down you want it a different color?

    Best regards,
    Jordan Shannon

    #1020432

    Hi, yes as I start to scroll down the page the color changes?

    #1021213

    Hi,

    To change the header background color on page scroll, please enable shrinking header from Enfold > Header > Header Behavior

    And use the below CSS

    #top #header.header-scrolled .container.av-logo-container {
    	background: gold;
    }

    Best regards,
    Vinay

    #1021279

    Unfortunately never worked, any other suggestions? Added my logins if you need to look?

    #1021388

    Hi,

    The CSS Merging was enabled in Enfold > Performance tab. This will cache the CSS files so you were not able to view the changes. Whenever you add any CSS or JS please disable this option and refresh the page a few times to view changes.

    I also adjusted the code to below :

    #top #header.header-scrolled #header_main {
    	background: #88bbc8;
    }

    Best regards,
    Vinay

    #1023689

    Thank you!

    #1024036

    Hi,

    Did you need additional help, or shall we close this topic?

    Best regards,
    Jordan Shannon

    #1172379

    Hi,
    Is it possible to change the header color, without having to activate the shrinking header?
    Best regards,
    Sebastian

    #1172463

    Hi,

    So you want it a single color at all times? If it’s only when scrolling then attaching it to the shrinking class is the most sensible way of doing it.

    Best regards,
    Jordan Shannon

    #1172471

    Hi,
    Thanks for your quick answer.
    I want it to change its color once when i scroll down the page up to a certain point.
    I’ll give you a page where I saw it in the private content.
    It should not be shrinking at all if possible. And the text of the menu should change its color as well if that’s possible, too.

    #1173218

    Hi,

    Thank you for the update.

    Is it possible to change the header color, without having to activate the shrinking header?

    The required class attribute header-scrolled is only available when the shrink option is enabled and the css modifications above will not work without this attribute, so it has to be enabled. You can always use css to prevent the header from shrinking even if the option is enabled.

    Now, if you want the header to only change after scrolling down up to a certain point or position, then you have to modify the enfold\js\avia-snippet-sticky-header.js. Add another condition in the else statement.

     if(st - 30 < el_height)
    	                {
    	                    av_change_class(header, 'remove', 'header-scrolled-full');
    	                }
    	                else
    	                {
    	                    av_change_class(header, 'add', 'header-scrolled-full');
    	                }
    

    Best regards,
    Ismael

    #1173246

    Okay, thank you for the tips. Unfortunately my programming skills aren’t good enough to do so, but maybe some day the will be!
    Thanks a lot!

    #1173409

    Hey,

    You are welcome!
    Please let us know if you need further assistance on this case :)

    Regards,
    Yigit

    #1405270

    I tried both of these on my site and neither changed the color when scrolling down?

    #top #header.header-scrolled .container.av-logo-container {
    background: gold;}

    #top #header.header-scrolled #header_main {
    background: #88bbc8;}

    #1405300

    Hi,
    Please note that these will only work if your header is set to Enfold Theme Options ▸ Header ▸ Header behavior ▸ Shrinking Header this is the only time that the class header-scrolled is added.
    I tested the css and it works, if it is not working for you and you are using the Shrinking Header option then please open a new thread with an admin login so we can be of more assistance, since this is not your thread posting your login here will not be private and you will not see anything we write in the Private Content area.

    Best regards,
    Mike

    #1405308

    with the new enfold – you can set the shrink amount to 10% – maybe Günter will be persuaded to include the 1% mark in the list there. In that case, a reduction would be hardly noticeable, and the classes would then be set anyway.

    btw. i’m not willing to check pages that are not secured bei SSL ( TLS ) ;)

    or leave the header as it is- no shrink and set your own scroll event on the header
    this to child-theme functions.php:
    you had to set in this calculation the rgb values!

    function bg_color_on_scroll(){
    ?>
    <script>
    window.addEventListener("DOMContentLoaded", function () { 
    (function($){
      var tStart = 30, // Start transition at 30px from top
          tEnd = 250,   // End at 250px
          cStart = [255, 255, 255],  // White
          cEnd = [255, 215, 0],   // Gold
          cDiff = [cEnd[0] - cStart[0], cEnd[1] - cStart[1], cEnd[2] - cStart[2]];
    
        $(".header_color .header_bg").css('background-color', 'rgb('+cStart+')');  // take over the start point
    
        $(document).scroll(function() {
            var p = ($(this).scrollTop() - tStart) / (tEnd - tStart); // % of transition
            p = Math.min(1, Math.max(0, p)); // Clamp to [0, 1]
            var cBg = [Math.round(cStart[0] + cDiff[0] * p), Math.round(cStart[1] + cDiff[1] * p), Math.round(cStart[2] + cDiff[2] * p)];
            $(".header_color .header_bg").css('background-color', 'rgb(' + cBg.join(',') +')');
        });
    })(jQuery); 
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'bg_color_on_scroll');

    you see the parameters you can change? – the var values
    and the selector ( .header_color .header_bg ) on the bottom might differ to yours – as mentioned above your page is not https.

    #1405436

    Thank you

Viewing 20 posts - 1 through 20 (of 20 total)
  • You must be logged in to reply to this topic.