Open jQuery Accordion with link
Hi there,
I have inserted this jQuery accordion on my website:
- //accordion
- jQuery(document).ready(function() {
- function close_accordion_section() {
- jQuery('.accordion .accordion-section-title').removeClass('active');
- jQuery('.accordion .accordion-section-content').slideUp(300).removeClass('open');
- }
- jQuery('.accordion-section-title').click(function(e) {
- // Grab current anchor value
- var currentAttrValue = jQuery(this).attr('href');
- if(jQuery(e.target).is('.active')) {
- close_accordion_section();
- }else {
- close_accordion_section();
- // Add active class to section title
- jQuery(this).addClass('active');
- // Open up the hidden content panel
- jQuery('.accordion ' + currentAttrValue).slideDown(300).addClass('open');
- }
- e.preventDefault();
- });
- $('.text_slider').text_slider(DETECTION.phone);
- });
This is the html:
- <div class="accordion soft_clear">
- <div class="accordion-section">
- <a class="accordion-section-title" href="#accordion-1"><span>HEADLINE</span></a>
- <div id="accordion-1" class="accordion-section-content">
- <p>
- TEXT HERE
- </p>
- </div>
- </div>
- </div>
However I'd like to have an accordion section open when I insert a link like this:
www.website.com#accordion-5
Do you have a solution for that?
Please bare with me - I have found several threads for that regarding the same issue but I couldn't figure it out though :(
Thanks a million!