不跳转的滚动窗口(javascript 或主题标签)
我想要一个使用指向锚标记名称的主题标签或 javascript 的解决方案。
我当前使用的 JavaScript 看起来像这样 window.scroll(0, 20000);
。问题是,当用户到达页面时,这会导致窗口猛然下降。
我知道有 jQuery 动画可以让这个动作更加渐进。然而,我想要的是让用户感觉不到窗口的移动。我想要就像用户登陆到页面底部一样。
I want a solution either using a hashtag pointing at the name of an anchor tag or javascript.
The javascript I am currently using looks like this window.scroll(0, 20000);
. The problem is that this causes the window jerk down when a user arrives on the page.
I know there are jQuery animations that make this movement more gradual. However, what I want is something that makes the movement of the window imperceptible to the user. I want to be as if the user landed at the bottom of the page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您面临的问题是您希望转到尚未加载的页面底部。我会考虑以隐藏格式加载页面,然后在页面全部加载后以及将用户滚动到您想要的位置后显示它。使用焦点或滚动到方法。
看看长丝集团的网站。
http://filamentgroup.com/
他们隐藏带有加载屏幕的页面,直到准备好为止。
这样就没有混蛋了。
希望这有帮助。
The problem you face is that you wish to go to the bottom of your page which has not loaded yet. I would consider loading the page in a hidden format then show it when it has all loaded and after scrolling the user at the location you want. Use the focus or scroll to methods.
Take a look at the filament group website.
http://filamentgroup.com/
they hide the page with a loading screen until it is ready.
This way there is no jerk.
Hope this helps.
如果页面完全加载并显示,则在循环中它可以工作:(
请注意 20*1000=20000,这是原始滚动位置。)
In loop it works, if the page is fully loaded and shown:
(Notice that 20*1000=20000, which was the original place to scroll.)
Teemu的答案似乎对我不起作用(它直接到底部,使带有scrollBy步进的循环不可见),因为它没有实现延迟。
如果您打算在 1000 毫秒内从页面顶部到底部制作动画,请尝试类似这样的操作:
这将提供 1 秒(1000 毫秒)的动画,以大约 1000 步滚动到底部。
Teemu's answer doesn't seem to work for me (it goes straight to the bottom, making the loop with scrollBy stepping invisible), because it doesn't implement a delay.
If you mean to animate from top to bottom of the page in a 1000ms, try something more like this:
That will give a 1 second (1000ms) animation, scrolling to the bottom in roughly 1000 steps.