Tagged: deeplinking, tab section
-
AuthorPosts
-
June 15, 2023 at 10:23 am #1410682
Hi,
Hi, I think since the last theme update the function doesn’t work anymore, the section is loaded but it doesn’t scroll to the section.
Here is the functions.php script:// custom script */
// scroll to active tab section
function ava_custom_script_tab_section() {
?>
<script type=”text/javascript”>
(function($) {
function scrollToTab(s, e,) {
$(s).on(e, function(event) {
var anchor, loc, cur, hash, tab, parent, pos;if( e == ‘load’ ) {
loc = window.location.hash;
hash = loc;
} else {
loc = $(this).attr(‘href’);
hash = loc.substring(loc.indexOf(‘#’));
}tab = $(‘.av-section-tab-title[href=’+ hash +’]’);
parent = tab.parents(‘.av-tab-section-outer-container’);
pos = parent.offset();tab.trigger(‘click’);
if(hash) {
setTimeout( function() {
$(window).scrollTop( pos.top – 100 )
}, 1000 );
}
});
}scrollToTab( ‘.menu-item a’, ‘click’ );
scrollToTab( window, ‘load’ );
})(jQuery);
</script>
<?php
}
add_action( ‘wp_footer’, ‘ava_custom_script_tab_section’, 9999 );Can you help me please? Thank you!
Best regards,
SoltnerJune 17, 2023 at 11:47 pm #1411002Hey soltner,
This script seems to be working on my test site, but your site has a javascript error.
First check that this option is disabled: Enfold Theme Options ▸ Performance ▸ Load jQuery in your footer and you don’t have any plugin deferring javascript. Then disable Enfold Theme Options ▸ Performance ▸ JS & CSS file merging and compression and enable Enfold Theme Options ▸ Performance ▸ Delete old CSS and JS files and clear your browser cache and check again.
Then try disabling your plugins, If this doesn’t help please include an admin login in the Private Content area so we can be of more assistance.add_action( 'wp_footer', 'ava_custom_script_tab_section' ); function ava_custom_script_tab_section() { ?> <script type="text/javascript"> (function($) { function scrollToTab(s, e,) { $(s).on(e, function(event) { var anchor, loc, cur, hash, tab, parent, pos; if( e == 'load' ) { loc = window.location.hash; hash = loc; } else { loc = $(this).attr('href'); hash = loc.substring(loc.indexOf('#')); } tab = $('.av-section-tab-title[href='+ hash +']'); parent = tab.parents('.av-tab-section-outer-container'); pos = parent.offset(); tab.trigger('click'); if(hash) { setTimeout( function() { $(window).scrollTop( pos.top - 100 ) }, 1000 ); } }); } scrollToTab( '.menu-item a', 'click' ); scrollToTab( window, 'load' ); })(jQuery); </script> <?php }
Best regards,
MikeJune 19, 2023 at 8:27 am #1411036Hey Mike,
wonderful, your tip solved the problem :-)
many thanks for the great support!Best regards,
SoltnerJune 19, 2023 at 12:13 pm #1411058Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Deeplinking into Tab Section does not work anymore’ is closed to new replies.