1

ポストバック時に Foundation タブの状態を維持する最良の方法は何ですか? できれば、Cookie を使用しない方法です。

<dl class="tabs">
  <dd class="active"><a href="#simple1">Simple Tab 1</a></dd>
  <dd><a href="#simple2">Simple Tab 2</a></dd>
  <dd class="hide-for-small"><a href="#simple3">Simple Tab 3</a></dd>
</dl>
<ul class="tabs-content">
  <li class="active" id="simple1Tab">This is simple tab 1s content. Pretty neat, huh?</li>
  <li id="simple2Tab">This is simple tab 2s content. Now you see it!</li>
  <li id="simple3Tab">This is simple tab 3s content.</li>
</ul>
4

1 に答える 1

1

これは最善の解決策ではないかもしれませんが、私の .Net プロジェクトではうまくいきます。

<asp:HiddenField runat="server" ID="currentTab" Value="0" />

$(document).ready(function() {
    var tb = $(this).find("input[id*='currentTab']").val();
    if (tb == null) {
        tb = 0;
    }
    if (tb == 1) {
        //alert("Tab 1");
        tabName = "t4"
        window.location.hash = tabName;
        return false
    }
    if (tb == 2) {
        //alert("Tab 2");
        tabName = "t2"
        window.location.hash = tabName;
        return false
    }
    if (tb == 3) {
        //alert("Tab 3");
        tabName = "t3"
        window.location.hash = tabName;
        return false;
    }
});

Protected Sub Button_Click1(sender As Object, e As EventArgs) Handles Button.Click
currentTab.Value = "3"
End Sub
于 2013-03-21T14:34:35.500 に答える