Open accordion based on URL and target ID

As the title suggest… I saw this https://stackoverflow.com/questions/22254248/bootstrap-3-expand-accordion-from-url
Would any Js gurus know if any of the solutions might work in blocs

Blocs 3 uses Bootstrap 4, which required a different approach. I have a Bric in the works that works for Tabs and I am also including Accordions into it.

Its been on the back burner for a bit. But recently @JDW tested an early version for me.

1 Like

Hi malachiman.
I noticed the last post in my link mentioned bootstrap 4.4 - do you think that might work?

I found this related to bootstrap 4 -

if (window.location.hash) {
            var jQuerytarget = jQuery('body').find(window.location.hash);
            if (jQuerytarget.hasClass('collapse')) {
                var jQuerytargetAccordion = jQuerytarget.find('.collapse');
                jQuerytarget.collapse('show');
            }

}

But doesn’t seem to work in footer/header or after docx. - just leaves some stray text on the page. im only testing using the preview as I prefer not to go live unless it has a chance of working.

Not sure whether the code will work or not, but if you wanted to test it, upload a copy of your website to a subfolder in your domain hosting account. You will then be able to check if everything works online. Just add the sub-folder name to your URL in a web browser. Once you’re happy, you can delete the sub-folder.

Good tip. Assuming it works Would the code be added to the page footer?

I added Accordion support today to my bric. It will be available shortly, just need to make a support page for it.

Shortly = hopefully this week. I have a staff meeting tomorrow and that may change my entire week as we start removing social restrictions here in New Zealand.