在某个滚动点处启动页面 [英] Starting a page at a certain scroll point

查看:88
本文介绍了在某个滚动点处启动页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种方法(使用CSS3,JS或其间的任何东西)来获取页面在某一点开始滚动吗?

Is there a way (with CSS3, JS, or anything in between) to get a page to start at a certain point scrolled down?

为我的页面加载,而不是头部最初显示在加载(意味着它在用户的实际视口上方)。

I'd like for my page to load without the header initially displaying on load (meaning it's above the actual viewport of the user).

有一个简单/容易的方法去?

Is there a simple/easy way to go about this?

推荐答案

您可以使用标准javascript:window.scroll(x,y)

You can use standard javascript: window.scroll(x, y).

考虑到你会在 onload 这样做,即窗口应该从(0,0)开始。用(x,y)玩,直到你的标题到你喜欢的位置。

This should work pretty well considering that you'll be doing this at onload, i.e. the window should begin at (0, 0). Play around with (x, y) until you get your header to the position that you're happy with. Naturally you'll need to change it anytime the header moves.

例如:

<body onLoad="window.scroll(0, 150)">

这篇关于在某个滚动点处启动页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆