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

Incorrect behavior after home/end key trigger #368

Open
unbrokenclayman opened this issue Feb 22, 2019 · 7 comments
Open

Incorrect behavior after home/end key trigger #368

unbrokenclayman opened this issue Feb 22, 2019 · 7 comments

Comments

@unbrokenclayman
Copy link

Let's say we have 10 slides and scroll to the last, then press Home, getting to the first one, but now if we do scrolling upside, we will get to the 9th slide.
Same in reverse direction.

@prototype23
Copy link

prototype23 commented Feb 25, 2019

@unbrokenclayman you can use this code to fix that problem:
$(window) .off('keyup.myNamespace') .on('keyup.myNamespace', function (e) { if (e && e.which) { switch (e.which) { case 35: case 36: setTimeout(function () { scrollify.update(); }, 10); break; default: } } });

@unbrokenclayman
Copy link
Author

@unbrokenclayman you can use this code to fix that problem:
$(window) .off('keyup.myNamespace') .on('keyup.myNamespace', function (e) { if (e && e.which) { switch (e.which) { case 35: case 36: setTimeout(function () { scrollify.update(); }, 10); break; default: } } });

That way doesn't working for me and causes even more problems: after I press home/end keys several times it may stops somwhere at the middle of page.

@prototype23
Copy link

prototype23 commented Feb 27, 2019

Do you have an animation on the scroll? The setTimeout function on my example must have longer duration than the scroll duration.

If still you have issues, you could try to prevent the default action of home/end keys.

@unbrokenclayman
Copy link
Author

Do you have an animation on the scroll? The setTimeout function on my example must have longer duration than the scroll duration.

Nope, just native chrome scrolling. I trying to set time around 1000ms, which should be more than enough, but without success.

If still you have issues, you could try to prevent the default action of home/end keys.

Why should'nt plugin set active slide properly itself after scrolling to top or bottom?

@prototype23
Copy link

I'm not the creator of this plugin :D

@unbrokenclayman
Copy link
Author

unbrokenclayman commented Feb 27, 2019

Adding code like this at the end of plugin keyHandler function helps:

} else if(e.keyCode==36) {
  e.preventDefault();
  index = 0;
  move(index, false);
} else if(e.keyCode==35) {
  e.preventDefault();
  index = heights.length-1;
  move(index, false);
}

@unbrokenclayman
Copy link
Author

Ah, there already was a pull request #203

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

2 participants