-
Notifications
You must be signed in to change notification settings - Fork 13
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
Always move to the top of the page #6
Comments
Hey @zhaoyi0113, I haven't heard of this issue. Can you provide more details so I can recreate? |
I also have this problem, changing the code to the following works, because it sets maxScrollPositionToZero. var maxScrollPosition = documentHeight;// - clientHeight; but id rather know what the intention was when deleting the same 2 values. I am using chrome btw |
The intention comes from #3 to limit scrolling to the document height to avoid a hard collision with the bottom. I'm having trouble replicating this on my end to debug. Can you provide a code sample? This is as far as I got: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div class="" style="height: 500px;"></div>
<div id="scrollTo" class="">here</div>
<div class="" style="height: 400px;"></div>
<button id="btn" type="button" name="button">scroll</button>
</body>
<script type="text/javascript">
const scrollToElement = require('scroll-to-element')
const btn = document.querySelector('#btn')
btn.addEventListener('click', (e) => {
e.preventDefault()
scrollToElement('#scrollTo')
})
</script>
</html> |
are you resolved? |
Ensure that html tag is with height: 100vh property setted. I had this problem today and put height 100vh in html tag solved my problem. |
My react component includes three sub-components. They are vertically aligned. I want to move to the second component which the user clicks on the first component, but it always moves to the top of the screen. Any idea about this issue?
The text was updated successfully, but these errors were encountered: