div滚动到javascript [英] div scroll to in javascript

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

问题描述

我有几个带有内容的 div.一些上下文被包裹,

I have several divs with content. Some of the context is wrapped with,

content <a name='SomeName'> cool content </a> more content

在 Javascript 中,如何强制 SomeName 名称仅滚动到该 DIV 的视图中.问题是页面上有很多包含内容的 DIV.

In Javascript how do I force the SomeName name to scroll into view for that DIV only. The catch is that there are many DIVs on the page with content.

我知道 Div 的对象.Div 可以在层次结构中包含其他 div 等.某处有 SomeName 锚点.

I have the Div's object known. The Div can contain other divs etc in a hierarchy. Somewhere in there is the SomeName anchor.

网站:http://BiblePro.BibleOcean.com

推荐答案

scrollintoview 命令怎么样?不确定那是否特定于 IE.

what about scrollintoview command? Not sure if thats IE specific.

document.getElementById("SomeName").scrollIntoView(true);

document.getElementById("SomeName").scrollIntoView(true);

这篇关于div滚动到javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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