Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1079294

    Hi guys,

    I have a sticky header with two buttons. I’d like the “get started” button background to turn blue once you start scrolling down the page and the header sticks. Can someone help with this?

    thanks so much

    #1079509

    Hey bobfurgo,
    Please look in your custom css for your button’s color, it has the !important; on it so it’s hard to overwrite.
    Try to comment out only the color and background, like this:

    #top #wrap_all .header_color .av-menu-button-colored > a .avia-menu-text {
        /*color: #0077ff !important;*/
       /* background: white !important;*/
         border-color: white !important;
         margin-left: -15px !important;
    }

    Then try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_button_color_scroll(){
      ?>
      <script>
    (function ($) { 
      $(window).scroll(function() {    
          var scroll = $(window).scrollTop();
          if (scroll >= 80) {
              $(".responsive #top #wrap_all #header.header_color .menu-item-109.av-menu-button-colored a span.avia-menu-text").css({ 'background': '#0077ff', 'color': '#fff'});
              $("#top #wrap_all #header.header_color #menu-item-109.av-menu-button-colored a span.avia-menu-text").css({ 'background': '#0077ff', 'color': '#fff'});
          } else {
              $(".responsive #top #wrap_all #header.header_color .menu-item-109.av-menu-button-colored a span.avia-menu-text").css({ 'background': '#0077ff', 'color': '#fff'});
              $("#top #wrap_all #header.header_color #menu-item-109.av-menu-button-colored a span.avia-menu-text").css({ 'background': '#fff', 'color': '#0077ff'});
          }
      });
      })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_button_color_scroll');
    

    Then clear your browser cache. If this doesn’t work then please include admin login in the Private Content area so we can be of more assistance.

    Best regards,
    Mike

    #1121963

    Hi Mike!

    Thanks so much, unfortunately it didn’t work. Here are the login details:

    #1122005

    Hi,
    Thanks for the feedback, I tried checking your site, but the login didn’t work on the domain login, please check.

    Best regards,
    Mike

    #1122007

    Please see private area, thanks!

    #1122015

    Hi,
    Thanks, that login allowed me to get to the WordPress login but the WP password didn’t work, please check.

    Best regards,
    Mike

    #1122175

    Hi Mike, please see private area for new pw, thanks!

    #1122393

    Hi,
    Thanks for the login, I committed out the css and added the function in your child theme functions.php
    It seems to be working now, please clear your browser cache and check.

    Best regards,
    Mike

    #1122978

    Hi Mike!

    Thanks for your help. However I cleared the browser cache and on scroll both the button and text on the button is white. On scroll, i’d like the button background to be blue and the text color white, so i’m not sure if it’s working.

    #1123039

    Hi,
    Odd, this seemed to be working before, but now when I disable your css merging in Enfold Theme Options > Performance > JS & CSS file merging and compression your css merging is still showing.
    I have now removed the script I posted and commented out the css to have a clean start and try again but I’m still seeing the merged css file, Your server is well known for it’s cache, but typically the test domains from your server (such as yours) are not cached.
    So, I’m going to wait a few hours to see if this clears up, and try again.
    Please reply to this so it will show up for me again and I can work on this some more. (we only see open topics), I hope this makes sense to you :)
    Anyways, I’m sure we can sort this out, right now it looks like a cache issue. Please ask your webhost if they are caching, and if they are, please ask to clear it, otherwise, I’ll try again later.
    Thank you for your patience.

    Best regards,
    Mike

    #1123180

    Hi Mike! Thanks so much for the update and for your efforts! It looks like the button is now dark blue, with white text but at all times. I’d just like for the button to be blue (specifically this color: #0077ff) but only as you scroll down the webpage and the header sticks. During all other times, the button should just be white with #0077ff text.

    #1123381

    Hi,
    Thank you for your patience, I have added this css to your Quick CSS and now the button is working correctly:

    #top #wrap_all .header_color.header-scrolled #menu-item-109.av-menu-button-colored > a .avia-menu-text {
        background-color: #0077ff !important; 
        color: #ffffff !important; 
    }
    #top #wrap_all .header_color #menu-item-109.av-menu-button-colored > a .avia-menu-text {
        background-color: #ffffff !important; 
        color: #0077ff !important; 
    }

    Please clear your browser cache and check.

    Best regards,
    Mike

    #1123566

    Hi Mike, thanks SO much for your help!

    #1123668

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘make button a different color on scroll’ is closed to new replies.