0

別のページにあるボタンからスライダーの特定のスライドにリンクしようとしているため、アンカー リンクが機能しません。スライダーの上にあるスライダー ドキュメント内でアンカー リンクを使用することを考えましたが、うまくいきませんでした。

理想的には、このような方法で特定のスライドにアクセスできるようにしたいと考えています。

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/

基本的に、指定された URL を介してスライド 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();
        }
4

1 に答える 1

0

読み込み時に、ナビゲーション要素を見つけてクリックをトリガーしてください。

$(window).load(function() {
  if(window.location.hash) {
   // Fragment exists
   var myhash = window.location.hash.substring(1);
   $("#showcase-navigation-button-"+myhash).trigger('click');
  }
});

上記の例は、1 つのショーケース用です。

于 2013-04-03T16:53:52.950 に答える