2013-04-03 41 views
0

我試圖從位於單獨頁面上的按鈕鏈接到滑塊中的特定幻燈片,因此錨鏈接將無法工作。我想過在位於滑塊上方的滑塊文檔中使用錨鏈接,但這不起作用。試圖通過url加載到jQuery滑塊中的特定幻燈片

理想情況下,我希望能夠以這種方式訪問​​特定的幻燈片。

http://myslider.com/index.html#1 
http://myslider.com/index.html#2 
http://myslider.com/index.html#3, etc. 

我正在使用Awkward Showcase滑塊。每個滑動件位於這樣一個div內:

<div class="showcase-slide"> 
    <!-- Put the slide content in a div with the class .showcase-content. --> 
    <div class="showcase-content"> 
     <img src="images/01.jpg" alt="01" /> 
    </div> 
</div> 

下面是滑塊的實例頁:http://showcase.awkwardgroup.com/

基本上,我正在尋找一種方法來直接加載到滑動2或4,等等通過指定的網址。

我知道我需要鏈接到數組,我想我需要添加一些東西到這個功能......可能。

var contentArray = []; 
    var thumbnailArray = []; 
    var content_count = 0; 
    showcase.children('.showcase-slide').each(function() 
    { 
     // Get content 
     var object = jQuery(this); 
     content_count++; 


     if(window.location.hash) { 
     // Fragment exists 
     var myhash = window.location.hash.substring(1); 
     $("a[i++'" + myhash + "']").click(); 
     } 

回答

0

加載時嘗試找到導航元素並觸發點擊。

​​

上面的例子僅用於一個展示。

+0

得到它的工作! – user1855009

相關問題