I want to scroll to the top whenever I click category from SC Categories Widget?

Gian1
Tera Contributor

We have a requirement, when we select Categories on the left handside that it should automatically scroll back up. At the moment if a category is all the way at the bottom and click on that category, the users think that the page is blank and end up generating unnecessary calls. 

How do I go about fixing this?

 

7 REPLIES 7

Yousaf
Giga Sage

Hi Gian,

window.location.reload(); 

You can this line in script to refresh the page 

 

Mark Correct or Helpul if it helps.

Thanks,

Yousaf

Komal39
Tera Contributor

Hello, 

Please suggest where to add this line specifically in javascript. Thank you.

Mohith Devatte
Tera Sage

Hello ,

While click on thr category they must have called a client side function .

Can you put below code in that function and try

window.scroll({ top: 0, left: 0, behavior: 'smooth' });

Please mark my answer correct if it helped you