-
AuthorPosts
-
March 15, 2019 at 11:23 pm #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
March 17, 2019 at 12:11 am #1079509Hey 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,
MikeJuly 25, 2019 at 7:32 pm #1121963Hi Mike!
Thanks so much, unfortunately it didn’t work. Here are the login details:
July 26, 2019 at 12:12 am #1122005Hi,
Thanks for the feedback, I tried checking your site, but the login didn’t work on the domain login, please check.Best regards,
MikeJuly 26, 2019 at 12:21 am #1122007Please see private area, thanks!
July 26, 2019 at 2:28 am #1122015Hi,
Thanks, that login allowed me to get to the WordPress login but the WP password didn’t work, please check.Best regards,
MikeJuly 26, 2019 at 3:09 pm #1122175Hi Mike, please see private area for new pw, thanks!
July 27, 2019 at 5:36 pm #1122393Hi,
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,
MikeJuly 30, 2019 at 12:02 am #1122978Hi 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.
July 30, 2019 at 4:56 am #1123039Hi,
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,
MikeJuly 30, 2019 at 4:09 pm #1123180Hi 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.
July 31, 2019 at 3:51 am #1123381Hi,
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,
MikeJuly 31, 2019 at 4:01 pm #1123566Hi Mike, thanks SO much for your help!
July 31, 2019 at 10:59 pm #1123668Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘make button a different color on scroll’ is closed to new replies.