2013-05-21 50 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