Tagged: anchor links
-
AuthorPosts
-
October 26, 2017 at 8:42 pm #869309
Hi Enfold Support,
We have a tab section set up and each tab has an anchor link that had been working great. When we first set it up any menu links containing the tab anchor would work perfectly fine scrolling to the section and opening the assigned tab. Although we’re now noticing that the anchor links are showing some odd behavior in that they 1) don’t scroll to the tabbed section and 2) if you’re on the same page and use the main nav menu to go to the tabbed section, it doesn’t work at all i.e. won’t open the associated tab.Can you please take a look and see if anything odd with how this is working? it’s odd that it worked initially but after a couple theme updates, no longer works. We did update to the latest theme version but still no change. Links and access are located in private area.
Is there a way to link to the tab section (which currently works) but open to the various tabs i.e. an anchor link to the tab within an anchor link to the section? It’s still odd that this worked before and now doesn’t.
Thank you!October 26, 2017 at 8:43 pm #869311Please note that the top link in the main navigation is set to go to the tab section on the page and to open tab number 1 but that also isn’t working as expected.
October 29, 2017 at 5:12 pm #870121Hi Eric,
Have you tried disabling all plugins and checking if the issue remains?
Best regards,
VictoriaNovember 7, 2017 at 4:41 am #873520Ok so we deactivated all the plugins with no change in the menu anchor link behavior. The main issue is the anchor link to the tabs don’t tell the browser to scroll to the tab section on the page. Only if we use a section ID for the anchor will the browser scroll to the tabbed section and then it’ll only open to the tab designated in the tab section edit screen (see screenshot in private area).
Any idea what might be causing this behavior? Thanks!
November 9, 2017 at 6:33 am #874435Hi,
Thank you for the info.
The main issue is the anchor link to the tabs don’t tell the browser to scroll to the tab section on the page.
Please try this script in the functions.php file to force the window to scroll to the tab section.
// custom script 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,
IsmaelDecember 4, 2017 at 11:36 pm #884861I have the similar issue. When I click on the links on the tabbed section on this page: https://visualwilderness.com
the browser does not scroll to the tabbed section. So to a user it appears that the links are not working at all.The same behavior is present when someone tries to navigate to the tabbed section directly using a URL like this: https://visualwilderness.com/#browse-our-ebooks
@ismael,
I tried your script, but this did not fix the issue. Let me know if you want me to try out something different.Thanks.
-JayDecember 5, 2017 at 3:00 pm #885089Hi,
@pateljx: Where are the links or menu items? Please note that the script will only work if the links are on the same page as the tab section.
Best regards,
IsmaelDecember 5, 2017 at 11:57 pm #885264It is on the same page as the tabbed section…Now I see why it is not working.
Is there a way so that when I click on ANY tab in the tab section, the tab section can scroll to the top of the page? This would make the tab section enormously valuable. This will be ideal for our page: https://visualwilderness.comThanks.
-JayDecember 6, 2017 at 8:59 am #885441Hi,
Why would you want it to scroll to the top of the page? Where are the menu items for the tab section? I’m sorry but I can’t find it anywhere.
Best regards,
IsmaelDecember 6, 2017 at 4:16 pm #885632@Ismael This is the issue. When someone visits my page he sees this:
View #1: Default Home Page ViewThe tab section is located at the bottom of the page. When the visitor clicks on any of the tab section the page position does not change and it appears as if the tab section links are not working. What I would like to do is the visitor clicked on the blue tab section marked Infocus Newsletter the page should scroll up and present him with this view:
View #2: Tab Section at the TopAlternatively if someone visits this page with the URL: https://visualwilderness.com/#infocus-newsletter the page should present him with the view #2 as well. Does this make sense?
- This reply was modified 6 years, 11 months ago by Jay.
December 6, 2017 at 4:49 pm #885657Hi all, I too have tried the script and am still seeing the problem Jay describes above. I did notice the script fixes clicking to a tab from the menu if on the same page. That wasn’t working before the functions.php script update.
Oddly clicking on an anchor link and having the browser scroll to the tabbed content worked when we first added the tabbed content in the beginning of last summer. Something happened that broke this functionality between updates from then until a couple updates ago. IThanks!
December 6, 2017 at 5:05 pm #885665@Ismael – This is a problem with 2017 Enfold Demo as well.
If you click on this URL: https://kriesi.at/themes/enfold-2017/#mailchimp-newsletter one would expect the page to show you the tab section with Mailchimp integration, but instead it show you the top of the page. So the visitor would have no clue where the Mailchimp integration was located. He will have to scroll and find it himself…or he will assume that it is a bad link.
- This reply was modified 6 years, 11 months ago by Jay.
December 7, 2017 at 6:01 am #885933Hi,
@ismael – This is a problem with 2017 Enfold Demo as well.
You cannot open a tab section with anchors by default. It’s NOT the same as the accordion or toggle element, so you would have to add the script.
Best regards,
IsmaelDecember 7, 2017 at 6:13 am #885942We do have the script added to the functions.php file in the child theme directory and it helped in that the menu anchor link now goes directly to the selected tab. Although the browser still does not scroll down to the tabbed content. The user is expecting to go to the content described in the link but instead may think the link is broken.
Very strange that this used to work as expected last summer ie both anchor links to target tab AND scrolling down the page so all the tabbed content is above the fold.
December 7, 2017 at 6:56 am #885949How it works today is irrelevant. We know how it works today. The issue is that my visitors today have already send me an email letting me know that the links on tab section links are NOT working because they do not see the content below the page changing.
If it appears to my visitors that the links on Tab Section are broken than I cannot use this element on the page. Scrolling the tab section to the top of the page (if icons are located at the top and scrolling to the bottom of the page if they are located on the bottom of the section) would be a simple fix that make the design of tab section more robust.
This is a serious design flaw in the what is otherwise a superbly designed element and should be addressed to make the element more robust….and until you do that, I am asking is there a work around?
FYI: Eric is right about how this element works even with the script. It does not scroll to the top of the page. So this is NOT an effective work around.
- This reply was modified 6 years, 11 months ago by Jay.
December 12, 2017 at 1:51 am #887663Hi,
It does not scroll to the top of the page. So this is NOT an effective work around.
The page should scroll to the tab section when the designated tab section anchor or links are clicked as long as the script is enabled. Where is the tab section in your page again? I can’t find it anywhere in the home page.
Best regards,
IsmaelDecember 12, 2017 at 2:10 am #887665We get 5000 Visitors a day…and several of them emailed me informing that the links to the website were not working correctly. So we removed the tab section element. Visitor complains is not something we take lightly….and cannot have this active.
You can debug the page on your demo site…it works exactly the same way. My post from Dec 6, explains what the problem is. If you cannot figure out why a visitor would complain about broken links, I suggest that you, @kriesi or another designer contact me directly via email and I can explain exactly what the problem is.
Thanks.
-Jay- This reply was modified 6 years, 11 months ago by Jay.
December 12, 2017 at 3:07 am #887673@ismael, you should be able to see the issue on my client’s site. Credentials and page URL are located in private area. And yes your 2017 demo does have the same issue as Jay points out. Again, all this worked fine several updates ago when we first started playing with using the tab element feature.
One thing we noticed was anchoring to the tab section. For whatever reason that will have the browser scroll to the tab section and has a function in the avia element builder to designate which tab to open to. Seems we simply need a similar function to scroll to the tab section and open to a specific tab.
Hope this helps solve the mystery of the busted tab element UI. :)
December 12, 2017 at 5:26 am #887705Hi,
@Eric: The Apperance > Editor panel is not accessible on your site. The page scrolls to the tab section when the anchors are clicked but it’s not opening the tab sections. We need to modify the script a bit.
Best regards,
IsmaelDecember 12, 2017 at 5:31 am #887710Hi Ismael, we turn off access for security purposes. it’s accessible now for you. Please comment on what’s been modified so we can replicate on production. Thanks!
December 13, 2017 at 12:51 pm #888296Hi,
It’s working now. We added the following line in the script.
tab.trigger('click');
Best regards,
IsmaelDecember 13, 2017 at 1:26 pm #888321December 13, 2017 at 1:39 pm #888331Hey!
Ah yes. Sorry about that. It’s the same code above.
// https://kriesi.at/support/topic/anchor-links-not-scrolling-to-tab-section-tabs/#post-874435
Cheers!
IsmaelDecember 15, 2017 at 7:29 pm #889388Hi Ismael, thanks for updating the script. It looks like it works when clicking on the main nav when on the page where the tabbed content resides. Unfortunately if you’re on any other page and click on the link to the tabbed content found in the main nav menu, the target tab opens but doesn’t scroll down to the tabbed content.
Is there additional script to force the browser to scroll to the tabbed content when clicking from a different page with the same URL that contains the tabbed content anchor? Thanks!
December 16, 2017 at 5:01 am #889471Hi,
We modified the script again so that it also scrolls to the tab section on load.
Best regards,
IsmaelDecember 16, 2017 at 6:05 am #889474Thanks Ismael! Works great.
For future enfold customers is this the script that fixed the problem?
// CUSTOM SCRIPT ANCHOR LINKS TO OPEN SCROLL TO TABBED CONTENT
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 )
}, 500 );
}
});
}scrollToTab( ‘.menu-item a’, ‘click’ );
scrollToTab( window, ‘load’ );
})(jQuery);
</script>
<?php
}// custom script
//add_action( ‘wp_footer’, ‘ava_custom_script’ );
function ava_custom_script() {
?>
<script type=”text/javascript”>
(function($) {
function a() {
$(‘.menu-item’).on(‘click’, ‘a’, function(e) {
var anchor, loc, cur, hash, tab, parent, pos;
anchor = $(this).attr(‘href’);
hash = anchor.substring(anchor.indexOf(‘#’));
tab = $(‘a[href=’+ hash +’]’);
parent = tab.parent(‘.av-tab-section-tab-title-container’);
pos = parent.offset();tab.trigger(‘click’);
if(hash) $(window).scrollTop( pos.top – 100 );
});
}a();
})(jQuery);
</script>
<?php
}
?>- This reply was modified 6 years, 11 months ago by Eric.
December 16, 2017 at 12:23 pm #889526Hi,
You can remove the previous script and keep the following code.
// https://kriesi.at/support/topic/anchor-links-not-scrolling-to-tab-section-tabs/#post-874435
Best regards,
IsmaelJanuary 3, 2018 at 4:54 am #892725Hi Ismael,
Happy new year!
thanks a lot for your help, your script works perfect on Firefox with my PC but when i use it with my ipad(2nd generation, IOS 9.3.5) on safari the links of my menu are not scrolling to Tab Section, what can i change on the script to make it possible with the ipad?
thanks ,
best regards
AlexJanuary 4, 2018 at 5:29 am #893089 -
AuthorPosts
- The topic ‘Anchor Links Not Scrolling to Tab Section Tabs’ is closed to new replies.