【问题标题】:Javascript Tab NavigationJavascript 选项卡导航
【发布时间】:2014-07-31 17:20:43
【问题描述】:
  $(".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”,另一个是“umember”。所以我希望能够: www.mysite.com/page/dashboard#profile 或 www.mysite.com/page/dashboard#umember

提前感谢

【问题讨论】:

  • 尝试做一个演示,它会帮助你更快地得到答案plnkr.co

标签: javascript php jquery tabs


【解决方案1】:

所以你想根据哈希改变标签?

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多