简体   繁体   English

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

[英]How to make a link - link to a DIV?

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? 我有一个Tumblr博客的轮播,每个博客帖子都有单独的DIV,但是还有一个DIV,用于诸如名称/说明之类的信息。单击该按钮时,如何使按钮滑动到该DIV? The layout is here and the one that would be the description has a "2" next to the text. 布局在此处 ,将作为描述的布局在文本旁边带有“ 2”。 Thanks in advance :) 提前致谢 :)

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. 应该做你想做的。

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可以使其逐渐下降到一定程度

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM