Advanced Hover Settings

Advanced Hover Settings For Joomla Website Builder Gridbox
Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

Open specific accordion entry

8 months 2 weeks ago #1

  • Marco Weinrich's Avatar
  • Marco Weinrich
  • Posts: 70
Hello

Is it possible to open a specific accordion Element on Page load?
With an attribute on a link or something...

For example:
link1 to accordion Page opens the first accordion Element
link2 to accordion Page opens the second accordion Element

Thanks
Marco

8 months 2 weeks ago #2

  • Rene's Avatar
  • Rene
  • Posts: 658
Open the accordion Element of your choice in the edit mode.

Save the page.....

8 months 2 weeks ago #3

  • Marco Weinrich's Avatar
  • Marco Weinrich
  • Posts: 70
Shure, but that‘s not what i was asking for...
i want to open different accordion entrys like i wrote e.g.

mylink#one

would Open the first accordion entry and so on

8 months 2 weeks ago #4

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 19688
Hello,

You need to use this code.
var tabsLink = window.location.hash
document.addEventListener('DOMContentLoaded', function(){
 var a = document.querySelector('a[href="'+tabsLink+'"].accordion-toggle');
 if (a) {
  a.click();
 }
})

You need to replace the menu links
to link to this page + tab hash.

Best Regards,
Vyacheslav, Balbooa Support Team

8 months 2 weeks ago #5

  • Marco Weinrich's Avatar
  • Marco Weinrich
  • Posts: 70
That's what I ment. :)

It's working fine, thank you !

8 months 2 weeks ago #6

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 19688
You are welcome ;)
Let us know if you need more assistance!

Best Regards,
Vyacheslav, Balbooa Support Team

1 month 2 days ago #7

  • Jeremie's Avatar
  • Jeremie
  • Posts: 102
Hi !

I have a very similar question : I want to integrate in the top of my page a sort of menu of buttons that will open the accordion entries.

So I tried to edit my buttons with these parameters :
link : #collapse-16321754602
target : same window
type: default
embed code: document.querySelector('a[href="'#collapse-16321754602'"].accordion-toggle.click();

When I click the button, it puts the good accordion title on top of the page, but does not open the entry.
Any idea how to make it work ?

Jérémie

1 month 2 days ago #8

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 19688
Hello,
Thank you for contacting us

Send us a link to page with problem.

Regards,
Vyacheslav, Balbooa.com

1 month 1 day ago #9

  • Jeremie's Avatar
  • Jeremie
  • Posts: 102
Hi,

Here is the link to the page : [url=https://xn--centremdicaldesbains-h2b.ch/physiotherapie]https://xn--centremdicaldesbains-h2b.ch/physiotherapie[/url]

Buttons are on the video.

Jérémie

1 month 1 day ago #10

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 19688
You need to use this JS code
document.addEventListener('DOMContentLoaded', function(){
    jQuery('.class a').on('click', function(){
        document.querySelector('.accordion-toggle[href="'+this.getAttribute('href')+'"]').click()
    })
});

Regards,
Vyacheslav, Balbooa.com

1 month 1 day ago #11

  • Jeremie's Avatar
  • Jeremie
  • Posts: 102
Not sure I understand where to put this code : I added this as embed code in the button, but it does not work. I also added this to the JS of the page, it does not work neither.

Is there another way to use this code ?

1 month 1 day ago #12

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 19688
You need to add this code at the code editor

Best Regards,
Vyacheslav, Balbooa Support Team

4 weeks 2 hours ago #13

  • Jeremie's Avatar
  • Jeremie
  • Posts: 102
Ok, I added this to the code editor, in the javascript tab.

I made my buttons point on a url of the type "#collapse-1632175522934".

When i click on the button, the result is that it scrolls to the good accordion entry, but it doesn't open it.
And it does not generate an error in the console.

This site is a Joomla 4, I don't know if it can have an importance...

4 weeks 2 hours ago #14

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 19688
You need to add a suffix class for your button and replace it in your code


Regards,
Vyacheslav, Balbooa.com

3 weeks 6 days ago #15

  • Jeremie's Avatar
  • Jeremie
  • Posts: 102
Yes ! It works better with a target class !

However, it is still not working as I expect : it opens the accordion entry, but scrolls way too low. I understand that this way : the link will first scroll to the entry, and then it opens the accordion entry, which changes page construction.

Do you have an idea on how to solve that ?

3 weeks 5 days ago #16

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 19688
Unfortunately, this is not possible.
Because the anchor is in the content of the accordion.

Regards,
Vyacheslav, Balbooa.com
Powered by Kunena Forum