-
AuthorPosts
-
February 5, 2019 at 2:07 pm #1063183
I have created a page which includes the Tab section element – https://tapintoit.org.uk/one-to-one/
I would like to be able to create a URL for each tab i.e. if I wanted someone to look at the pricing on this page I could give them a URL that would open that tab on this page – https://tapintoit.org.uk/one-to-one/ rather than it open, by default, on tab 1 – Benefits.
I am not a developer and see that there have been other discussions regarding this issue.
I added the code suggested in other messages to my child theme functions.php and refreshed the website but nothing happened.
// auto trigger
add_action(‘wp_footer’, ‘ava_custom_script’);
function ava_custom_script() {
?>
<script>
(function($){
function getQueryParams(qs) {
qs = qs.split(“+”).join(” “);
var params = {},
tokens,
re = /[?&]?([^=]+)=([^&]*)/g;while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
}return params;
}var $_GET = getQueryParams(document.location.search);
$(window).load(function() {
switch($_GET[‘tabsort’]) {
case ‘Benefits’:
$(‘a[data-av-tab-section-title=”Benefits”]’).trigger(‘click’);
break;
case ‘Get Set Up’:
$(‘a[data-av-tab-section-title=”Get Set Up”]’).trigger(‘click’);
break;
case ‘Get Started’:
$(‘a[data-av-tab-section-title=”Get Started”]’).trigger(‘click’);
break;
case ‘Support’:
$(‘a[data-av-tab-section-title=”Support”]’).trigger(‘click’);
break;
case ‘Pricing’:
$(‘a[data-av-tab-section-title=”Pricing”]’).trigger(‘click’);
break;
}
});
})(jQuery);
</script>
<?php
}But I am not sure that this is the correct script for what I have on my page – I don’t have buttons on my tabs….
Please can someone explain the stages simply i.e. step by step as I am not a developer and I am building this on a voluntary basis.
Many thanks
February 6, 2019 at 7:39 pm #1063733Please help…..
February 8, 2019 at 12:29 pm #1064557Hi still waiting for some help….
February 11, 2019 at 7:03 am #1065319Hi,
Thank you for using Enfold. And I would like to apologize for the late response.
The tab section has changed a lot since, so that script is no longer valid. Please try this one instead:
// auto trigger tab section add_action('wp_footer', 'ava_go_to_tab_section'); function ava_go_to_tab_section() { ?> <script> (function($){ function getQueryParams(qs) { qs = qs.split("+").join(" "); var params = {}, tokens, re = /[?&]?([^=]+)=([^&]*)/g; while (tokens = re.exec(qs)) { params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); } return params; } function triggerTabSection( section) { $('a[href="' + section + '"]').trigger('click'); } var section = getQueryParams( document.location.search ); triggerTabSection( section ); })(jQuery); </script> <?php }
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.