Javascript标签导航


Javascript Tab Navigation

  $(".wojo.tab.content").hide();
  $(".wojo.tabs a:first").addClass("active").show();
  $(".wojo.tab.content:first").show();
  $(".wojo.tabs a").on('click', function () {
      $(".wojo.tabs a").removeClass("active");
      $(this).addClass("active");
      $(".wojo.tab.content").hide();
      var activeTab = $(this).data("tab");
      $(activeTab).show();

我试图使一个href链接直接到一个特定的选项卡。我有两个。假设1是"uprofile",另一个是"member"。所以我希望能够:www.mysite.com/page/dashboard#profile或www.mysite.com/page/dashboard#umember

thanks ahead of time

所以你想改变基于哈希的选项卡?

var hash = window.location.hash;
if (hash.length>1) {
    var elem = $(hash);
    //do what you want to show it
}