如何建立链接 - 链接到DIV?

时间:2022-11-15 16:26:12

I have a carousel for a Tumblr blog and there are separate DIVs for each blog post, but there is also a DIV for info like name/description etc.. How would I make a button that slid to that DIV when clicked? The layout is here and the one that would be the description has a "2" next to the text. Thanks in advance :)

我有一个Tumblr博客的旋转木马,每个博客文章都有单独的DIV,但也有一个DIV用于信息,如名称/描述等。如何点击时滑动到该DIV的按钮?布局在这里,将是描述的布局在文本旁边有一个“2”。提前致谢 :)

3 个解决方案

#1


5  

If you give the div an id, then you can use the id value as an anchor, so

如果你给div一个id,那么你可以使用id值作为锚,所以

<div id="foo">something</div>

coupled with

<a href="#foo">click me</a>

should do what you want.

应该做你想做的事。

#2


0  

Check out jQuery Slide To

查看jQuery Slide To

#3


0  

they are called anchors :

他们被称为锚:

<a href="#anchorName">go to div</div>
<a name="anchorName">Example<a>

of course having it gradually move down to a point can be achieved with moveto in javascript

当然可以通过javascript中的moveto实现逐渐向下移动到某一点

#1


5  

If you give the div an id, then you can use the id value as an anchor, so

如果你给div一个id,那么你可以使用id值作为锚,所以

<div id="foo">something</div>

coupled with

<a href="#foo">click me</a>

should do what you want.

应该做你想做的事。

#2


0  

Check out jQuery Slide To

查看jQuery Slide To

#3


0  

they are called anchors :

他们被称为锚:

<a href="#anchorName">go to div</div>
<a name="anchorName">Example<a>

of course having it gradually move down to a point can be achieved with moveto in javascript

当然可以通过javascript中的moveto实现逐渐向下移动到某一点