2013-03-16 3 views
1

포스트 백에서 Foundation 탭의 상태를 유지하는 가장 좋은 방법은 무엇입니까? 쿠키를 사용하지 않는 것이 바람직합니다.Zurb-Foundation 탭 상태 유지

<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> 

답변

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