Scroll product details to top on navigation
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 51s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 51s
This commit is contained in:
@@ -143,6 +143,15 @@ const ProductDetails = () => {
|
|||||||
const [variantCurrentPage, setVariantCurrentPage] = useState(1);
|
const [variantCurrentPage, setVariantCurrentPage] = useState(1);
|
||||||
const [variantItemsPerPage, setVariantItemsPerPage] = useState(5);
|
const [variantItemsPerPage, setVariantItemsPerPage] = useState(5);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const scrollContainer = document.querySelector<HTMLElement>('.app-content');
|
||||||
|
if (scrollContainer) {
|
||||||
|
scrollContainer.scrollTo({ top: 0, behavior: 'auto' });
|
||||||
|
} else {
|
||||||
|
window.scrollTo({ top: 0, behavior: 'auto' });
|
||||||
|
}
|
||||||
|
}, [id]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let isMounted = true;
|
let isMounted = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user