1

嘿伙计们可以链接一个div和url吗?基本上我想要 2 个链接合二为一。一个链接以#div 为目标,一个链接以 div 中的实际站点 url 为目标。

我的目标是一个 div,但需要将 url 加载到 div 中。

<a href="http://site.com/product/product-link" class="class-here">

我只能使用这个 url 访问 div:

<a href="#modal" class="class-here">

描述它的更好方法是这样的,但这显然不起作用:

<a href="http://site.com/product/product-link" target="#modal" class="second">

我将 div #modal 隐藏在这些标签中:

{{#product_page}}

Content is here

{{/product_page}}

很难解释,所以更多细节让我知道。

4

3 回答 3

2

你很亲密,就是这样:

 <a href="http://site.com/product/product-link#modal">

您可以通过将其附加到 url 的末尾来链接到任何 id,例如,这里是我的评论的链接

于 2013-05-21T12:54:09.977 回答
1

我不太明白你想做什么,但这也许有用

id 属性可用于在 HTML 文档中创建书签。

<div id="tips">Useful Tips Section</div>
Create a link to the "Useful Tips Section" inside the same document:

<a href="#tips">Visit the Useful Tips Section</a>
Or, create a link to the "Useful Tips Section" from another page:

<a href="http://www.w3schools.com/html_links.htm#tips">
Visit the Useful Tips Section</a>

资源

于 2013-05-21T12:57:39.917 回答
0

我发现这个解决方案有效:

HREF 链接:

<a href="javascript:$.closeit({ direction: 'left', href: 'http://site.com/product/product-link' })">

将此脚本放在我的页面底部:

<script>

    $(".class-here").closeit({ direction: "left", modal: true });
</script>

感谢所有帮助过我的人。

于 2013-05-21T15:23:55.650 回答