滚动到特定元素 [英] Sroll to particular element

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

问题描述

大家好,


是否可以将窗口(实际上是一帧)滚动到特定的

元素。例如,我在页面底部附近有一些元素

(需要滚动,可能需要2到3页才能获得这个

内容),而且我'我想将窗口滚动到该元素(在这个
的情况下,元素有标记:< strong class = highlight> some

text< / strong>) ?


谢谢,

-KJ

Hello all,

Is it possible to scroll a window (a frame, actually) to a particular
element. For example, I have some elements near the bottom of the page
(which requires scrolling, maybe 2 or 3 pages worth to get to this
content), and I''d like to scroll the window to that element (in this
case, the element has markup: <strong class=highlight>some
text</strong>)?

Thanks,
-KJ

推荐答案

KJ写道:

KJ wrote:


是否可以将窗口(实际上是一帧)滚动到特定的

元素。例如,我在页面底部附近有一些元素

(需要滚动,可能需要2到3页才能获得这个

内容),而且我'我想将窗口滚动到该元素(在这个
的情况下,元素有标记:< strong class = highlight> some

text< / strong>) ?
Is it possible to scroll a window (a frame, actually) to a particular
element. For example, I have some elements near the bottom of the page
(which requires scrolling, maybe 2 or 3 pages worth to get to this
content), and I''d like to scroll the window to that element (in this
case, the element has markup: <strong class=highlight>some
text</strong>)?



< a href ="#ANCHOR">转至底部< / a>

< br>< br> ;< br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< b>< br> < br>< br>< br>

< br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< b>< br>< br>< br>< br>

< br> ;< br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< b> <峰; br><峰; br><峰; br><峰; br>

将峰; br><峰; br><峰; br><峰; br><峰; br><峰; br>< BR><峰; br><峰; br><峰; br><峰; br><峰; br>< b r的><峰; br><峰; br><峰; br><峰; br>

将一个名称= QUOT; ANCHOR">文字< / A>

将峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br& gt;< br>< b>< br>< br>< br>< br>


-

Bart

<a href="#ANCHOR">go to bottom</a>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<a name="ANCHOR">text</a>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>

--
Bart


是否有可能以编程方式实现(无需用户点击

)?


Bart Van der Donck写道:
Is it possible to achieve this programmatically (without requiring a
user click)?

Bart Van der Donck wrote:

KJ写道:

KJ wrote:


Is可以将窗口(实际上是一帧)滚动到特定的

元素。例如,我在页面底部附近有一些元素

(需要滚动,可能需要2到3页才能获得这个

内容),而且我'我想将窗口滚动到该元素(在这个
的情况下,元素有标记:< strong class = highlight> some

text< / strong>) ?
Is it possible to scroll a window (a frame, actually) to a particular
element. For example, I have some elements near the bottom of the page
(which requires scrolling, maybe 2 or 3 pages worth to get to this
content), and I''d like to scroll the window to that element (in this
case, the element has markup: <strong class=highlight>some
text</strong>)?



< a href ="#ANCHOR">转到底部< / a>

< br>< br> ;< br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< b>< br> <峰; br><峰; br><峰; br>

将峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br>< BR><峰; br><峰; br><峰; br><峰; br>< b r的><峰; br><峰; br><峰; br><峰; br>

将峰; br> ;< br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< b> <峰; br><峰; br><峰; br><峰; br>

将峰; br><峰; br><峰; br><峰; br><峰; br><峰; br>< br>< br>< br>< br>< br>< br>< b>< br>< br>< br>< br>

将一个名称= QUOT; ANCHOR">文字< / A>

将峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br >< br>< b>< br>< br>< br>< br>


-

Bart


<a href="#ANCHOR">go to bottom</a>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<a name="ANCHOR">text</a>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>

--
Bart


KJ写道:
KJ wrote:

Bart Van der Donck写道:
Bart Van der Donck wrote:

< a href ="#ANCHOR"> go to bottom< / a>

< br>< br>< br>< ; br>< br>< br>< br>< br>< br>< br>< br>< br>< b>< br>< br>< br>< br>

< br>< br>< br>< br>< br>< br>< br>< br>< br> <峰; br><峰; br><峰; br>< b r的><峰; br><峰; br><峰; br><峰; br>

将峰; br><峰; br>< ; br>< br>< br>< br>< br>< br>< br>< br>< br>< br>< b>< br>< br>< br>< br>

< br>< br>< br>< br>< br>< br>< br>< br> < GT&BR ;<峰; br><峰; br><峰; br>< B r的><峰; br><峰; br><峰; br><峰; br>

将一个名称= QUOT; ANCHOR" ;>文字< / A>

将峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br><峰; br>< br>< br>< br>< br>< b>< br>< br>< br>< br>
<a href="#ANCHOR">go to bottom</a>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>
<a name="ANCHOR">text</a>
<br><br><br><br><br><br><br><br><br><br><br><br><b r><br><br><br><br>


是否可以通过编程方式实现此目的(无需用户点击

)?
Is it possible to achieve this programmatically (without requiring a
user click)?



当然,从其他地方链接到该页面为PAGENAME.HTML#ANCHOR。


只是不要刷新到PAGENAME.HTML#ANCHOR或者你会得到一个无休止的
循环。如果您的页面是目录的索引,您可以将

索引修改为PAGENAME.HTML#ANCHOR(在Apache上,那是''DirectoryIndex

PAGENAME。 HTML#ANCHOR"在目录中的.htacess文件中。


-

Bart

Sure, by linking to that page from elsewhere as PAGENAME.HTML#ANCHOR.

Just don''t refresh to PAGENAME.HTML#ANCHOR or you will get an endless
loop. If your page is the index of a directory, you could modify the
index to PAGENAME.HTML#ANCHOR (on Apache, that''s "DirectoryIndex
PAGENAME.HTML#ANCHOR" in an .htacess file in the directory).

--
Bart


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

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