2014-01-21 78 views
0

我有一個jQuery選項卡。在第三個選項卡中單擊og按鈕時,選項卡將控件移動到第一個選項卡。我試了很多辦法像ASP隱藏字段和存儲當前選項卡沒有工作jQuery選項卡無法保留活動標籤,而回發

<div id="tabwrap"> 
    <ul id="tabs"> 
     <li><a href="#tabs-1" class="current">Attribute Based Control</a></li> 
     <li><a href="#tabs-2">Role Based Control</a></li> 
     <li id="tab3"><a href="#tabs-3">Users</a></li> 
     </ul> 
    <div id="content"> 
          <div id="tabs-1" class="tab-section"> 
</div> 
    <div id="tabs-2" class="tab-section"> 
</div> 
    <div id="tabs-3" class="tab-section"> 
<asp:Button ID="btnSearch" runat="server" Text="Submit" CssClass="buttonsmallRight" Visible="false" ClientIDMode="Static" /> 
</div> 
</div> 

的jQuery的標籤

$(function() { 
      $('.tab-section').hide(); 
      $('#tabs a').bind('click', function (e) { 
       $('#tabs a.current').removeClass('current'); 
       $('.tab-section:visible').hide(); 
       $(this.hash).show(); 
       $(this).addClass('current'); 
       e.preventDefault(); 
      }).filter(':first').click(); 

    }); 

CSS的jQuery

#tabs { 
    margin: 0; 
    overflow: hidden; 
    padding: 0; 
    zoom: 1; 
    position: relative; 
    top: 2px; 
    z-index: 1; 
    margin-left: -500px; 
} 

    #tabs li { 
     display: block; 
     list-style: none; 
     margin: 0; 
     margin-right: 1px; 
     padding: 0; 
     float: left; 
     text-align: center; 
    } 

     #tabs li a { 
      display: block; 
      padding: 2px 10px; 
      border: 2px solid #808080; 
      border-bottom: 0 none; 
      text-align: center; 
      text-decoration: none; 
      border-bottom: 1px gray; 
      /*background-color: #d4efff;*/ 
      background-color: #d6d7e4; 
      height: 22px; 
      font-size: 16px; 
      width: 150px; 
     } 

#tab-section { 
    background: #A59CFF; 
    padding: 10px; 
    border: 2px solid #6161f3; 
    margin-left: -700px; 
    width: 926px; 
} 

#tabs li a.current { 
    background: #A59CFF; 
    color: white; 
    border-bottom: 2px solid #A59CFF; 
    height: 22px; 
    font-size: 16px; 
    text-align: center; 
} 

回答

0

功能formLoad(){ //在這裏執行操作} 而不是$(function(){//在此處執行操作});

0

我已經解決了這個問題。我有一個更新面板,每次頁面加載時都會觸發。這是爲了在回發後保留jquery函數。該腳本有一個jQuery的選項卡腳本,每次發射後都會觸發它。 jquery的標籤部分從其中解決了錯誤:)

乾杯更新面板腳本, Kannappan

除去
相關問題