BilO Posted October 29, 2022 Share Posted October 29, 2022 Hi All, I am hoping to create a hover activated accordion for my website that is like this. https://codepen.io/uniqname/pen/nOVoyK I have been unable to get it to work on my site, so far with custom code. The page is private as we are still developing the page, but I am using the accordion block and my site is 7.0. Any help would be appreciated. Thanks! Link to comment
Beyondspace Posted October 29, 2022 Share Posted October 29, 2022 13 hours ago, BilO said: Hi All, I am hoping to create a hover activated accordion for my website that is like this. https://codepen.io/uniqname/pen/nOVoyK I have been unable to get it to work on my site, so far with custom code. The page is private as we are still developing the page, but I am using the accordion block and my site is 7.0. Any help would be appreciated. Thanks! Have you tried using the code block to add HTML and Css code on it yet? Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio pluginIf you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to comment
BilO Posted October 31, 2022 Author Share Posted October 31, 2022 Yes I tried to, but was unable to get the CSS right to work how I wanted it Link to comment
tuanphan Posted November 4, 2022 Share Posted November 4, 2022 On 11/1/2022 at 1:01 AM, BilO said: Yes I tried to, but was unable to get the CSS right to work how I wanted it You can setup site access password & share url. We can check easier But if you want to use whole Codepen code, you can add a Code Block > Paste this code <div class="accordion"> <section class="accordion-item"> <h1>Section 1</h1> <div class="accordion-item-content"> <p>Content for section 1</p> </div> </section> <section class="accordion-item"> <h1>Section 2</h1> <div class="accordion-item-content"> <p>Content for section 2</p> </div> </section> <section class="accordion-item accordion-item--default"> <h1>Section 3</h1> <div class="accordion-item-content"> <p>Content for section 3</p> <p>This is my default state.</p> </div> </section> <section class="accordion-item"> <h1>Section 4</h1> <div class="accordion-item-content"> <p>Content for section 4</p> </div> </section> </div> <style> /* The Magic */ .accordion:hover .accordion-item:hover .accordion-item-content, .accordion .accordion-item--default .accordion-item-content { height: 6em; } .accordion-item-content, .accordion:hover .accordion-item-content { height: 0; overflow: hidden; transition: height .25s; } /* Aesthetic */ body { background: #222; } .accordion { padding: 0; margin: 0 auto; width: 20%; font-family: "PT Sans" sans-serif } .accordion .accordion-item { background-image: linear-gradient(90deg, #eee, #f5f5f5, #eee); border-bottom: 1px solid #666; padding: 1em; color: #eee; } .accordion h1 { margin: 0; } .accordion .accordion-item:nth-child(1) { background-color: hsl(200, 80%, 60%); background-image: linear-gradient(-90deg, hsl(200, 80%, 60%), hsl(200, 80%, 45%) 2em, hsl(200, 80%, 60%)); } .accordion .accordion-item:nth-child(2) { background-color: hsl(280, 60%, 45%); background-image: linear-gradient(-90deg, hsl(280, 80%, 60%), hsl(280, 60%, 45%) 2em, hsl(280, 80%, 60%)); } .accordion .accordion-item:nth-child(3) { background-color: hsl(40, 80%, 40%); background-image: linear-gradient(-90deg, hsl(40, 80%, 60%), hsl(40, 80%, 45%) 2em, hsl(40, 80%, 60%)); } .accordion .accordion-item:nth-child(4) { background-color: hsl(80, 40%, 40%); background-image: linear-gradient(-90deg, hsl(80, 80%, 40%), hsl(80, 80%, 35%) 2em, hsl(80, 80%, 40%)); } </style> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care 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