2013-05-21 51 views
1

嘿家伙有可能链接一个div和url吗?基本上我想在一个2链接。一个链接指向#div,另一个链接指向div中的实际站点URL。链接#div和URL

我针对的是一个div,但需要在div中加载url。

<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}} 

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

+0

你问的是如何让浏览器滚动到div并同时将该div的HTML更改为与另一个HTML文档相同? – Quentin

+0

你可以使用jQuery吗? – Pete

+0

不,我想要定位url和div。我想要URL加载在div #modal,如果这是一个更容易的解释... – Nico

回答

0

我发现这个解决方案的工作:

的HREF链接:

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

地方这个脚本在我的页面的底部:

<script> 

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

谢谢大家帮助我。

2

你被关闭,它很简单:

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

您可以通过它附加到URL的末尾,作为一个例子链接到任何ID,here是我的评论

+0

没有运气那里的div #modal是一个叫做pageslide的jquery工具 – Nico

+0

@Nico你不能链接到一个jQuery工具,你通过它的ID链接到一个元素。如果你有类似'

'的东西,你可以追加'#pageslide'而不是##模式。 – Andy

+0

id #modal只是一个隐藏的CSS div。它围绕{{#product_page}}进行包装。 – Nico

0
链接

我不太明白你想要做但这也许可以工作

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> 

Source