Tagged: x
-
AuthorPosts
-
November 21, 2016 at 6:23 am #1265291
AlexParticipantHello,
want to link to an accordion tab.
It should jump to the tab and opens it.I found this topic:
https://community.theme.co/forums/topic/open-accordion-from-link/It jums to the tab but does not open it.
How can I fix that?Thank you very much for your help!
Regards,
AlexNovember 21, 2016 at 6:55 am #1265319
Paul RModeratorHi Alex,
Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
November 21, 2016 at 7:15 am #1265339
AlexParticipantThis reply has been marked as private.November 21, 2016 at 10:23 am #1265606
LelyModeratorHello Alex,
Thank you for the credentials.
Please use this code instead:/* Open Accordion from Link */ jQuery(function($){ $(document).ready(function() { var tabnum = location.href.split("#").slice(-1)[0] ; var tabnumber = tabnum.split("-").slice(-1)[0]; x_scroll_to_tab($, $('.x-accordion .x-accordion-group:nth-child('+tabnumber+')>div>a') ); }); }); function x_scroll_to_tab($, tab_nav) { $(tab_nav).click(); $('html,body').animate({scrollTop: $(tab_nav).offset().top - ( $('.x-navbar').height() + 50 )},700 ,'swing'); }Accordion structure is now different that’s why old code will not work. To access specific accordion tab you may access it like this:
http://myvirtualhost.com/open-accordion-tab-page/#collapse-2
We need to add this on the end of the URL:#collapse-2. Adjust to your preferred tab.Hope this helps.
November 22, 2016 at 4:02 am #1266625
AlexParticipantHello and thank you very much for your reply!
I have tried and it jumps to the accordion tab but it does not open.
I´ve created this text:
Jump and Open Tab/AccordionThe accordion tab has the ID: “ac-blend”
What is this class for?
What did I have made wrong?
Thanks for your help!
Regards,
AlexNovember 22, 2016 at 4:07 am #1266628
AlexParticipantOkay I´ve made it.
I used this link:
http://dev.whiskytasters.de/whisky-a-z/#ac-blend#collapse-4without classes, etc
Is this right?
Can´t I use IDs for opening the tab?
Because when I change the order of the accordion tabs I have to go over all links I´ve created to the tabs.Thank you very much!
Regards,
AlexNovember 22, 2016 at 5:34 am #1266680
LelyModeratorHello Alex,
Please update the code to this:
/* Open Accordion from Link */ jQuery(function($){ $(document).ready(function() { var tabnum = location.href.split("#").slice(-1)[0] ; if(window.location.href.indexOf("#") > -1) { x_scroll_to_tab($, $('.x-accordion .'+tabnum+'>div>a') ); } }); }); function x_scroll_to_tab($, tab_nav) { $(tab_nav).click(); $('html,body').animate({scrollTop: $(tab_nav).offset().top - ( $('.x-navbar').height() + 50 )},700 ,'swing'); }Then add ac-blend on the class field of accordion item. The URL to access that accordion now will be http://dev.whiskytasters.de/whisky-a-z/#ac-blend
Hope this helps.
November 22, 2016 at 7:13 am #1266745
AlexParticipantHello,
I have updated the code and added ac-blend to class field.
I also removed “ad-blend” from ID-field.It is working!
Is that right, that I have to remove it from ID-field?
Thank you very much!
Regards,
AlexNovember 22, 2016 at 7:37 am #1266766
JoaoModeratorHi Alex,
If it is working, it is totally fine.
Let us know if you need further help.
Joao
November 22, 2016 at 8:11 am #1266807
AlexParticipantGreat! 🙂
Thank you very very much for your help!
Regards,
AlexNovember 22, 2016 at 8:15 am #1266816
JoaoModeratorYou are welcome,
Let us know if you need help with anything else,
Joao
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1265291 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
