2012-04-02 10 views
0

JavaScriptとjQueryの新機能です。jQuery BBQ Plugin Confusion

バックページ機能を提供するためにjQuery BBQプラグインを使用しています。 、私はURLの負荷が罰金mysite.com/brandsに直接行けば今これは、素晴らしい作品

// Be sure to bind to the "hashchange" event on document.ready, not 
// before, or else it may fail in IE6/7. This limitation may be 
// removed in a future revision. 
$(function(){ 

    // Override the default behavior of all `a` elements so that, when 
    // clicked, their `href` value is pushed onto the history hash 
    // instead of being navigated to directly. 
    $(".content a").click(function(){ 
    var href = $(this).attr("href"); 

    // Push this URL "state" onto the history hash. 
    $.bbq.pushState({ url: href }); 

    // Prevent the default click behavior. 
    return false; 
    }); 

    // Bind a callback that executes when document.location.hash changes. 
    $(window).bind("hashchange", function(e) { 
    // In jQuery 1.4, use e.getState("url"); 
    var url = $.bbq.getState("url"); 

    // In this example, whenever the event is triggered, iterate over 
    // all `a` elements, setting the class to "current" if the 
    // href matches (and removing it otherwise). 
    $("a").each(function(){ 
     var href = $(this).attr("href"); 

     if (href === url) { 
     $(this).addClass("current"); 
     } else { 
     $(this).removeClass("current"); 
     } 
    }); 

    console.log(url) 
    $.getScript(url) 

    }); 

    // Since the event is only triggered when the hash changes, we need 
    // to trigger the event now, to handle the hash the page may have 
    // loaded with. 
    $(window).trigger("hashchange"); 
}); 

、と私はタブをクリックすると、URLがOKであるこのhttp://localhost:3000/trends#url=/trends/latestのように現れる:私は、次の実装を持っています戻るボタンは、ページの他のタブを通過するときに機能します。

$ .getScriptは、現在テンプレートに部分データを読み込んでいるJavaScriptを呼び出します。

問題は、1層単位でしか動作しないように見えることです。親ナビゲーションアイテムTrendsをクリックしてタブをクリックすると、プラグインが機能しません。そのようにそれを見ることを拒否する。

私はBBQプラグインが高度な機能を持っているのを見ることができますが、私が望むものがさらに進んでいるかどうかはわかりません。

誰かがjQueryから、または以前のプラグインの経験から何かできることを提案できますか?

非常に高く評価されています。

おかげで、

ジェフ

答えて