mindofalexander Posted August 23, 2023 Share Posted August 23, 2023 (edited) 👋 Hey Everyone, I'm currently facing a peculiar issue with a button on my "My Experience" page. When the button is hovered over, it turns dark grey instead of solid black as intended. My suspicion is that something in the Squarespace default code or theme settings is overriding my custom CSS or JavaScript. Would anyone be able to take a look and help me out? Below is the relevant code: --------------------- CSS: --------------------- /* Button Hover Styles */ .sqs-block-button-element--medium:hover, .sqs-button-element--primary:hover, .sqs-block-button-element:hover { background-color: #000000 !important; color: #FFFFFF !important; border: none !important; } --------------------- JavaScript: --------------------- <script> document.addEventListener('DOMContentLoaded', (event) => { console.log('Document is ready.'); let buttons = document.querySelectorAll('.sqs-block-button-element, .button.sqs-system-button.sqs-editable-button.sqs-button-element--primary.FecjBqAV0ViY3ijU58R1, .newsletter-form-button.sqs-system-button.sqs-editable-button-layout.sqs-editable-button-style.sqs-editable-button-shape.sqs-button-element--primary, .btn.btn--border.theme-btn--primary-inverse.sqs-button-element--primary'); console.log('Buttons found: ', buttons.length); buttons.forEach(button => { console.log('Adding animation to button', button); button.style.transition = 'transform 0.3s ease-in-out'; // Add smooth transition for transform only button.addEventListener('mouseover', function(){ this.style.transform = 'scale(1.06)'; }); button.addEventListener('mouseout', function(){ this.style.transform = 'scale(1.0)'; }); }); }); </script> I've already tried a few different methods to troubleshoot, including inspecting the element, modifying the `!important` attribute, and adding additional console logs, but haven't had any luck. Any guidance or insight would be much appreciated! Thanks in advance! 🙏My Website URL: dinosaur-trombone-43wa.squarespace.com Edited August 24, 2023 by mindofalexander Link to comment
Solution Web_Solutions Posted August 24, 2023 Solution Share Posted August 24, 2023 Just now, mindofalexander said: Bump! Replace the CSS code with the code below. /* Button Hover Styles */ .sqs-block-button-element--medium:hover, .sqs-button-element--primary:hover, .sqs-block-button-element:hover { background-color: #000000 !important; color: #FFFFFF !important; border: none !important; opacity: 1 !important; } Ainul 1 If my comments are useful, please like and mark my solution as answer. It will encourage me. Thanks MD Rofik Website Designer and Digital Marketer ☕Am I helpful? Want to offer me a coffee? ✉ Send me a message if needed any help. I'll try to reply as soon as possible. Link to comment
mindofalexander Posted August 24, 2023 Author Share Posted August 24, 2023 I appreciate your help thank you so much! Link to comment
Web_Solutions Posted August 24, 2023 Share Posted August 24, 2023 1 minute ago, mindofalexander said: I appreciate your help thank you so much! You're welcome! If my comments are useful, please like and mark my solution as answer. It will encourage me. Thanks MD Rofik Website Designer and Digital Marketer ☕Am I helpful? Want to offer me a coffee? ✉ Send me a message if needed any help. I'll try to reply as soon as possible. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment