usingmyhead Posted February 4, 2022 Posted February 4, 2022 I'm wondering if anyone has some code that will show an item from the Squarespace Accordion Block as open by default? I have checked the excellent thread by @tuanphan as well as others on the forum but couldn't find what I need. My client wants the first accordion item to be open when the page loads (then close/open as usual along with the others in the Accordion Block).
paul2009 Posted February 4, 2022 Posted February 4, 2022 14 minutes ago, usingmyhead said: I'm wondering if anyone has some code that will show an item from the Squarespace Accordion Block as open by default? My client wants the first accordion item to be open when the page loads This is a built-in feature 🙂 usingmyhead 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
usingmyhead Posted February 5, 2022 Author Posted February 5, 2022 Just goes to show, you're never too experienced to learn something new (and never too proud to embarrass yourself on a public forum) 😜
paul2009 Posted February 5, 2022 Posted February 5, 2022 ...and never more shocked than me to discover that something is built in and doesn't require code 😲 creedon, usingmyhead and conversiontracking 3 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
conversiontracking Posted February 5, 2022 Posted February 5, 2022 6 hours ago, paul2009 said: ...and never more shocked than me to discover that something is built in and doesn't require code 😲 I would have started coding without even checking for sure... 🤦♂️ usingmyhead and paul2009 2 Freelance Squarespace developer making plugins like Full-Width Blocks, Hover effects for grid gallery and the Darkmode plugin. I know Squarespace inside out and I'm able to solve pretty much any Squarespace code problem. Get in touch here!
MayaViolet Posted March 22, 2022 Posted March 22, 2022 On 2/4/2022 at 10:06 AM, paul2009 said: This is a built-in feature 🙂 Any insight on how to set all accordion blocks to be opened at once? I understand it would most likely take some javascript... Attempting to have a list layout on Desktop with each section always open, but then make it more mobile friendly aka accordion-functioning on mobile. Any thoughts?
tuanphan Posted March 24, 2022 Posted March 24, 2022 On 3/23/2022 at 4:39 AM, MayaViolet said: Any insight on how to set all accordion blocks to be opened at once? I understand it would most likely take some javascript... Attempting to have a list layout on Desktop with each section always open, but then make it more mobile friendly aka accordion-functioning on mobile. Any thoughts? Add to Design > Custom CSS /* Accordion Block - Expand all items */ .sqs-block-accordion .accordion-item__dropdown { display: block !important; } fred and The-Design-Order 2 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
MayaViolet Posted March 24, 2022 Posted March 24, 2022 9 hours ago, tuanphan said: Add to Design > Custom CSS /* Accordion Block - Expand all items */ .sqs-block-accordion .accordion-item__dropdown { display: block !important; } Oop - much easier than I thought 🤪 Thank you!
daniellenoakes Posted November 21, 2023 Posted November 21, 2023 On 3/24/2022 at 7:39 AM, tuanphan said: Add to Design > Custom CSS /* Accordion Block - Expand all items */ .sqs-block-accordion .accordion-item__dropdown { display: block !important; } how would we apply this to not all items, but say the 4th one? odd request i know! and is it possible to number the accordian list titles in a different font?! thank you so much this would be so helpful!!!
tuanphan Posted November 24, 2023 Posted November 24, 2023 On 11/22/2023 at 12:12 AM, daniellenoakes said: how would we apply this to not all items, but say the 4th one? odd request i know! and is it possible to number the accordian list titles in a different font?! thank you so much this would be so helpful!!! #1. Use this /* Accordion Block - Expand all items */ .sqs-block-accordion li:nth-child(4) .accordion-item__dropdown { display: block !important; } #2. Each titles in each accordion will use a different font name or font color or? daniellenoakes 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
daniellenoakes Posted December 1, 2023 Posted December 1, 2023 On 11/24/2023 at 3:30 AM, tuanphan said: #1. Use this /* Accordion Block - Expand all items */ .sqs-block-accordion li:nth-child(4) .accordion-item__dropdown { display: block !important; } #2. Each titles in each accordion will use a different font name or font color or? i'm trying to change the numbers to be a different font, here's my attempt: #block-yui_3_17_2_1_1700055594134_17636 .accordion-item__title h4 strong * {font-family: 'montserrat'!important; font-size:08.em!important; letter-spacing:0.2em!important;}
tuanphan Posted December 1, 2023 Posted December 1, 2023 33 minutes ago, daniellenoakes said: i'm trying to change the numbers to be a different font, here's my attempt: #block-yui_3_17_2_1_1700055594134_17636 .accordion-item__title h4 strong * {font-family: 'montserrat'!important; font-size:08.em!important; letter-spacing:0.2em!important;} Use strong b, strong instead of strong * If it still doesn't work, you can share link to page where you use accordion, I can check easier Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
daniellenoakes Posted December 1, 2023 Posted December 1, 2023 5 hours ago, tuanphan said: Use strong b, strong instead of strong * If it still doesn't work, you can share link to page where you use accordion, I can check easier I got it to work using your thread: with <strong> 01/ </strong> in the accordion title using code: #block-yui_3_17_2_1_1700055594134_17636 .accordion-item__title strong {font-family: 'montserrat'!important; font-size:12px!important; position:relative; top:-1vh!important; letter-spacing:0.2em!important; font-weight:400;} and this code in the page header code injection: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("span.accordion-item__title").each(function(){ $(this).html($(this).text()); }); }); </script>
daniellenoakes Posted December 1, 2023 Posted December 1, 2023 On 11/24/2023 at 3:30 AM, tuanphan said: #1. Use this /* Accordion Block - Expand all items */ .sqs-block-accordion li:nth-child(4) .accordion-item__dropdown { display: block !important; } #2. Each titles in each accordion will use a different font name or font color or? is there a way to use this code but then have the item close when another is expanded? i only want one open at a time ! thank you
tuanphan Posted December 3, 2023 Posted December 3, 2023 On 12/2/2023 at 12:14 AM, daniellenoakes said: is there a way to use this code but then have the item close when another is expanded? i only want one open at a time ! thank you Can you share link to a page where you use accordion, I can check easier daniellenoakes 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
daniellenoakes Posted December 4, 2023 Posted December 4, 2023 On 12/3/2023 at 3:50 AM, tuanphan said: Can you share link to a page where you use accordion, I can check easier www.annajonesbridal.co.uk/about-new
tuanphan Posted December 6, 2023 Posted December 6, 2023 On 12/4/2023 at 7:10 PM, daniellenoakes said: www.annajonesbridal.co.uk/about-new Try this code /* Accordion Block - Expand all items */ [data-section-id="6554d09ab712136bc5ed868e"] { .sqs-block-accordion li:nth-child(4) .accordion-item__dropdown { display: block !important; } [data-is-open="true"] ~ li.accordion-item .accordion-item__dropdown { display: none !important; }} daniellenoakes 1 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
daniellenoakes Posted December 6, 2023 Posted December 6, 2023 1 hour ago, tuanphan said: Try this code /* Accordion Block - Expand all items */ [data-section-id="6554d09ab712136bc5ed868e"] { .sqs-block-accordion li:nth-child(4) .accordion-item__dropdown { display: block !important; } [data-is-open="true"] ~ li.accordion-item .accordion-item__dropdown { display: none !important; }} amazing did the job thank you so much!
StephanieFlynnLaw Posted March 26 Posted March 26 On 3/24/2022 at 2:39 AM, tuanphan said: Add to Design > Custom CSS /* Accordion Block - Expand all items */ .sqs-block-accordion .accordion-item__dropdown { display: block !important; } Can this code be used for certain pages and not the entire site? I would like different sections to expand on different website pages.
tuanphan Posted March 29 Posted March 29 On 3/26/2024 at 3:49 PM, StephanieFlynnLaw said: Can this code be used for certain pages and not the entire site? I would like different sections to expand on different website pages. You can edit that page > Add a Block > Choose Code > Paste this code <style> /* Accordion Block - Expand all items */ .sqs-block-accordion .accordion-item__dropdown { display: block !important; } </style> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment