I am dealing with a challenge involving two pages - Home (vertical scrolling) and About (horizontal scrolling). I want to implement smooth scrolling, but I am encountering some issues.
When navigating from the Home page to the About page, the horizontal scrolling functionality on the About page stops working. However, refreshing the About page restores the horizontal scrolling function.
To troubleshoot the problem, I created a minimal version of the project. Upon investigation, I discovered that the line
import "../assets/locomotive-scroll.css";
is causing the issue. I attempted various strategies such as loading the CSS based on routes and lifecycle methods, but the problem persists.
Steps to reproduce the issue:
- Open the project and preview it in a new tab (default preview shows that smooth scrolling is not functioning)
- Smooth scrolling on emojis works on the Home page
- Click on "Go to About" to navigate to the About page
- Verify that horizontal scrolling is not working (refreshing the page fixes the issue)
- Remove the line
import "../assets/locomotive-scroll.css";
- Notice that smooth scrolling on emojis stops working, but horizontal scrolling on the About page functions correctly
Link to codesandbox.io (open preview in new tab)