Hi @chris.s, it seems that this happens when you select a tab lower than the one currently selected, e.g. clicking Tab 3 if Tab 2 is selected. It shifts down because when you click on the new tab, the tab title e.g. “Tab3” will stay where the cursor is, and because the other tab’s text now hides, the page will shift downwards to ensure the selected tab stays in place.
If you want to avoid the page actually shifting, it’s best if we just add some small custom code to essentially move the page up by the same amount of height as the current open tab’s text so that to the user the page remains still. Might sound a bit complicated but if you’re able to give me a version I can clone that would be great and I can test it out for you.
Hi @chris.s, I sent you an email separately about this but leaving the feedback here in case anyone else runs into this issue.
It seems to be a couple things - I changed the Tabs element to be aligned to the top (so the height of the tabs within will always stick to the top rather than float in the middle)
Then, give the “Tabs Menu” element have a top position of 180px (so that it moves down 180px).
Finally, add this custom code to the tag:
<script>
$('.w-tab-link').click(function(){
var oldTab = $(this).parent().find('.w--current').index(); //position of old tab
var newTab = $(this).index(); //position of new tab
if(newTab > oldTab) { // only keep position in place if you select a tab lower than the previous
$(this).parent().find('.w--current').find('.tabs-info-text').each(function(){
var y = $(window).scrollTop(); //your current y position on the page
$(window).scrollTop(y+$(this).height()+11);
});
}
});
</script>
Amazing, thank Andrew. Your solution works perfectly!
Thank you too for the update you emailed to target the script at Chrome only. For other reference here is the final version:
<script>
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
if(isChrome) {
$('.w-tab-link').click(function(){
var oldTab = $(this).parent().find('.w--current').index(); //position of old tab
var newTab = $(this).index(); //position of new tab
if(newTab > oldTab) { // only keep position in place if you select a tab lower than the previous
var y = $(window).scrollTop(); //your current y position on the page
$(window).scrollTop(y+$(this).parent().find('.w--current').find('.tabs-info-text').height()+11);
}
});
}
</script>