DIV水平滚动,如何加载到ID [英] DIV Horizontal scroll, how to onload to ID

查看:59
本文介绍了DIV水平滚动,如何加载到ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个站点,其中有许多水平滚动的DIV容器.我们希望在其中一个容器上将其滚动到onLoad上的某个位置.对最佳解决方案的建议是什么?

Have a site with MANY horizontally scrolling DIV containers. On one of the containers we want it to scroll to a certain position onLoad. Recommendations to what the best solution is?

更复杂的是,该容器在页面上垂直向下(即折叠以下),宁愿不具有onLoad结果,也不会导致页面垂直向下滚动到该容器,而只是滚动该特定容器水平的,别无其他.这也是可能的吗?

To complicate it a little more, the container is vertically far down (i.e. below the fold) on the page and would rather not have the onLoad result in having the page scroll vertically down to this container, merely have this specific container scrolled horizontally and nothing else. Is this also possible?

非常感谢.

推荐答案

您可以使用 scrollLeft 属性.

http://jsfiddle.net/v6EwS/

document.getElementById('foo').scrollLeft = 500;​

这篇关于DIV水平滚动,如何加载到ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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