Tagged: x
-
AuthorPosts
-
April 6, 2016 at 4:59 am #868918
Hi there,
We just updated to 4.4.1 and 1.2.2, and then noticed it had wiped our Custom Javascript with the changes to the new ‘Edit Global Javascript’ in ‘Customise’. So we re-entered our previous code which was…
jQuery( function($){ $( document ).ready( function(){ scroll_to_tab ( location.href.split("#").slice(-1)[0] ); }); $('a.link_to_tab, .link_to_tab a').on( 'click', function( e ){ var window_base = location.href.split("#").slice(0)[0]; var url_base = $( this ).attr('href').split("#").slice(0)[0]; if ( window_base == url_base ) { scroll_to_tab ( $( this ).attr('href').split("#").slice(-1)[0] ); e.preventDefault(); } }); function scroll_to_tab ( tab_id ) { var tab_nav = $('.x-nav-tabs .x-nav-tabs-item a[href="#' + tab_id + '"]'); if(tab_nav.length >=1) { $( tab_nav ).trigger('click'); $('html,body').animate({scrollTop: $(tab_nav).offset().top - ( $('.x-navbar').height() + 50 ) },700 ,'swing');} } });
…but now the function to ‘link to tabs’ isn’t working (cache’s been cleared too).
Here’s the page and the tab links are at the bottom of the first tab… Venus Hair Design
Any ideas how we can rectify this?
Thank you 🙂
April 6, 2016 at 9:02 am #869327Hi,
Kindly change your code to this.
jQuery( function($){ $( document ).ready( function(){ scroll_to_tab ( location.href.split("#tab-").slice(-1)[0] ); }); $('.link_to_tab a').on( 'click', function( e ){ var window_base = location.href.split("#").slice(0)[0]; var url_base = $( this ).attr('href').split("#").slice(0)[0]; if ( window_base == url_base ) { scroll_to_tab ( $( this ).attr('href').split("#").slice(-1)[0] ); e.preventDefault(); } }); function scroll_to_tab ( tab_id ) { console.log(tab_id); var tab_nav = $('.x-nav-tabs .x-nav-tabs-item a[data-cs-tab-toggle="' + tab_id + '"]'); if(tab_nav.length >=1) { $( tab_nav ).trigger('click'); $('html,body').stop().animate({scrollTop: $(tab_nav).offset().top - ( $('.x-navbar').height() + 50 ) },700 ,'swing');} } });
Hope that helps.
April 6, 2016 at 10:01 am #869444Getting closer but not quite back as it was yet…
If I use your JS and change $(‘.link_to_tab a’) to $(‘a.link_to_tab, .link_to_tab a’) then it works perfectly on other pages with links back to the tabs
i.e. the links on this page work in linking to a specific tab on our tabbed page.
But the links on each individual tab, still don’t link to the other tabs (which previously they were).
April 6, 2016 at 2:03 pm #869875Hi there,
Thanks for updating. As it’s a custom code of you so we really can’t assist on this much as it would be out of our support scope.
Thanks for understanding.
-
AuthorPosts