Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read properties of null (reading 'dataset') #28

Open
stuthemoo opened this issue Nov 18, 2024 · 2 comments
Open

Comments

@stuthemoo
Copy link

Sometimes on page load I get this error and I cannot scroll to the next section

@stuthemoo
Copy link
Author

Seems to be relateed to the loop option. If it's true then looping back to the first section will make the url hash 1 more than the total rater than setting it back to #1. If you then reload it looks for a section that doesn't exist and breaks.

@stuthemoo
Copy link
Author

For a quick fix change line 83 from:
if(window.location.hash != "" && window.location.hash != "#1") {
to:
if(window.location.hash != "" && window.location.hash != "#1" && document.querySelector(settings.sectionContainer + "[data-index='" + (window.location.hash.replace("#", "")) + "']")) {

if(window.location.hash != "" && window.location.hash != "#1") {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant