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

Problem with loop mode #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ilya-Zhulin
Copy link

@Ilya-Zhulin Ilya-Zhulin commented Jun 14, 2022

Hello, friend.
Example - I have 4 items in my page. Every item has index from 1 to 4. In the loop mode after 4 item page goes to the first item, BUT url postfix is #5. If I reload page in this state - script will have exception.

onepagescroll.js:88 Uncaught TypeError: Cannot read properties of null (reading 'dataset')
    at init (onepagescroll.js:88:39)
    at onePageScroll (onepagescroll.js:523:10)
    at (индекс):505:5

To fix this problem I made this little correction - I check if item with index from URL exists and set index to 1 if not.

Hello, friend. 
Example - I have 4 items in my page. Every item has index from 1 to 4. In the loop mode after 4 item page goes to the first item, BUT url postfix is `peachananr#5`. If I reload page in this state - script will have exception.
```onepagescroll.js:88 Uncaught TypeError: Cannot read properties of null (reading 'dataset')
    at init (onepagescroll.js:88:39)
    at onePageScroll (onepagescroll.js:523:10)
    at (индекс):505:5```
To fis this problem I made this little correction - I check if item with index from URL exists and set index to 1 if not.
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

Successfully merging this pull request may close these issues.

1 participant