you can add smooth scrolling animation to the page when moving to the top. You can achieve this by using CSS transitions or JavaScript libraries like scrollTo or animate. Here’s how you can implement smooth scrolling animation using CSS transitions:
const handleScrollToTop = () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
};
const handlePreviousPage = () => {
if (currentPage > 1) {
setCurrentPage(currentPage - 1);
handleScrollToTop();
}
};
const handleNextPage = () => {
if (currentPage < totalPages) {
setCurrentPage(currentPage + 1);
handleScrollToTop();
}
};
<button className='jjrewamp-casestudylistpage-leftbutton' onClick={handlePreviousPage}>
<img src="/Vector.svg" alt='NetSuite Expert' width={13} height={23} className='jjrewamp-casestudy-icon'/>
With this setup, when you click on the previous or next icons, the page will smoothly scroll to the top, providing a better user experience.