When clicking the tab link it will scroll to top of the tab content in mobile

Hey experts!

I created a tab for a website it’s ok in the Desktop version. But in the mobile version, the tab links are vertical with some content, so when I click on a tab link it needs to scroll up the tab content.

How can I do the process? is there any solution for it?

Thanks in advance :slight_smile:

1 Like

Insert your share link so people know what you’re talking about and/or can try to help you

1 Like

Here is the preview link -

https://preview.webflow.com/preview/searchperts?utm_medium=preview_link&utm_source=des[…]s&preview=48671722f8e86174b04045144283bbf2&workflow=preview

I already have solved the problem with this custom code. When you will go to the preview link you must guess, what I was looking for.

$("#button").click(function() {
    $('html, body').animate({
        scrollTop: $("#myDiv").offset().top
    }, 2000);
});

Thanks @Kevin_Mooney for your response.

2 Likes

@HelloEmon

does this solution still works? I copied your code and when testing mobile in the chrome emuluator on my pc, it works, but on android and apple devices it does not work.
I found out its because of the matchMedia… but now is the question how to solve this.

Dennis