This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Privacy Overview
Strictly Necessary Cookies
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.
Google Analytics
This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.
Keeping this cookie enabled helps us to improve our website.
Please enable Strictly Necessary Cookies first so that we can save your preferences!
Cookie Policy
More information about our Cookie Policy
8 Comments
Hello,
We’ve been trying to follow your directions on this and I feel like we are missing something. What exactly goes in the “PAGENAME” area of the code? Also, regarding the “Accordion ID”. The Fusion Builder automatically creates a unique URL for every accordion item. Wouldn’t it be best to use this instead? You can essentially copy/paste the URL and then get that unique id.
Last, if you wanted to this for each and every accordion item. I’m assuming you would have multiple versions of this code, correct?
Hello Donovan!
PAGENAME is an identifier for a site that contains an accordion. So it doesn’t trigger the Javascript on a page that has none. Sorry if I weren’t specific enough.
For example, if I have a unique identifier on a page lets say the body has the class “clubhouse”. I’d do jQuery(‘body.clubhouse’).length.
My approach was to have a nice looking URL instead of a generated code. Most users wouldn’t probably care and you could go with the ID of the Fusion Builder. The thought was if you’d sent a link to somebody domain.tld/#cool-name does look better than domain.tld/#472897422.
With this code, you have to duplicate the first half every time if you have multiple versions accord the site. the function doesn’t need to be duplicated since it will always work.
In my example and my client situation, I had only one specific page with an accordion. For a global scope I’d do something like this:
jQuery(document).ready(function(){
if(jQuery('.fusion-accordian').length){ // Identifier for the fusion accordion element
var accordionID = '#' + jQuery('.fusion-accordian > div').attr('id'); // get the Fusion accordions ID
jQuery(accordionID + ' .fusion-panel').each(function(){
var tmp = jQuery(this).find('.fusion-toggle-heading').text();
jQuery(this).find('a').attr('data-openlink', tmp.split(' ')[0].toLowerCase());
});
openAccordion(accordionID);
}
}
This should work if you have one accordion per page. If you have multiple on one page you should wrap everything inside the if-clause into a jQuery(‘.fusion-accordian’).each(function(){…})
Any thoughts on how to get this to work when the link is on the same page as the accordian?
Hey Wendy!
Sorry for the really late reply. Been really busy and didn’t see your comment.
In case you’re looking for the solution, yes I do know how to do it.
With a bit of tweaking, this should work on the same page. When I find the time I will make a new post to do it on the same page. If you need direct help. Message me your problem directly. 🙂 Greetings – Ingo
Hi Ingo,
I’m writing here because I’m not able to do this code work and I cannot understand why.
My website is a one-site page with some accordions that should be opened by clicking on some images redirecting to a link (#accordion1, #accordion2, etc) but at the moment on clicking on it nothing happens.
Maybe I’m wrong with the PAGENAME (I don’t know how it should be called properly) or I’m not inserting the code in the correct Custom Javascript (before head or body?).
Thanks for your code in advance, it is really useful to achieve a feature that is not able in Avada yet!
PS: looking for “documentales” or “obras de teatro” this images and toggles can be found easily (they have associated colors).
Answered by mail.
Hello
I’m trying to use your script in avada with a map svg separated by regions but even if the URL are correcy it doesn’t work.As you will see I’ve used a button too but nor button neither links in the map works.
This is the URL of my page:
ioparlopsicologia.it/partners/
Thank you in advance.
Regards
Luca
Hey, I looked at your website. And let me start by saying this is a really creative way of implementation!
The issue my script has is that it is only working if you go from another page to that specific point. I have to make an update soon on how to get it to work with on the same page toggles.
For you this Code should work
Also, you should wrap that in a document ready function just to be sure everything is there before trying to do .each() javascript.
I hope this helps! Looking forward to hearing from you