2012-04-01 18 views
0

我有一個網站上運行Codeigniter,我試圖通過鏈接鏈接到網頁上的元素,但是當你點擊鏈接頁面重新加載而不是轉向那個元素。Codeigniter無法鏈接到ID'd元素沒有新的頁面加載

<li> 
    <a href="#image-0001"> <img alt="image0001" src="/assets/images/portfolio/photography/thumbs/0001.jpg" /> 
<span>Pointe</span> </a> 
    <div class="lb-overlay" id="image-0001"> 
     <img alt="image01" src="/assets/images/portfolio/photography/full/0001.jpg" /> 
      <div> 
       <h3>pointe <span>/point/</span></h3> 
       <p>Dance performed on the tips of the toes</p> 
      </div> 
     <a class="lb-close" href="#page">x Close</a> 
    </div> 
</li> 

而不是觸發我的CSS動畫,它把我帶到站點根(本地主機/#圖像0001)。

任何想法如何解決這個問題?

+0

你也需要在你的目的地創建一個鏈接,使用. For example 'image01' – slashingweapon 2012-04-01 22:12:43

回答

0

要使用錨點移動頁面,目標錨點必須具有名稱而不是href。例如:

<a name="top" /> <!-- this is the target --> 
<p>Some really long content</p> 
<a href="#top">Go To Top</a> <!-- this goes to the target --> 

這不是特定於CodeIgniter的東西,只是基本的HTML。

相關問題