在每次点击页面重新加载时,在标签之间切换

时间:2016-02-29 14:39:24

标签: javascript jquery html

我有一个邮箱,我在其中使用展开折叠为收件箱选项卡,其中有一个名为MyInbox的子选项卡。只需单击任何选项卡,页面就会重新加载。

因此,当我使用以下代码时,即使在单击收件箱选项卡以显示子选项卡后,子选项卡仍保持隐藏状态。子选项卡juts扩展了几分之一秒,并在页面加载时隐藏。谁能告诉我可以做些什么?

我需要在页面加载时显示收件箱,点击收件箱后,它应显示MyInbox标签。

jQuery(document).ready(function () 
{
   jQuery(".child_tab").hide();
   jQuery(".parent_tab").click(function () 
   {                                 
      jQuery(".child_tab").not(jQuery(this).next(".child_tab")).hide();
      jQuery(this).next(".child_tab").toggle();
   });
});
<div id="EmailOptionR" style="background:#fff;">
   <div id="parent_tab">
      <span>
         <a href="@Url.Action("MailBox", "Email", new { view = "inbox", term = ViewBag.Term, fromDate = fromDate, toDate = toDate, currentUser = currentUser, currentUserUnRead = currentUserUnRead})" class="@(ViewBag.View == "inbox"?"selected" : "")" data-ajax-url="@Url.Action("", "Email")">
            <span class="text-align-l-g">
               <i class="fa fa-inbox"></i> @MultiLanguage.getText((int)Session[SessionAttributes.LanguageID], SessionVariables.ProjectId, "Organisation Inbox")
               <span class="pull-right">
                  <span id="inboxBadge" class="badge badge-warning">@Inbox</span>
               </span>
            </span>
         </a>
      </span>
   </div>
   <div class="child_tab">
      <a href="@Url.Action("MailBox", "Email", new { view = "inbox", term = ViewBag.Term, fromDate = fromDate, toDate = toDate, currentUser = currentUser, currentUserUnRead = currentUserUnRead, flag = true})" class="@(ViewBag.View == "inbox"?"selected" : "")" data-ajax-url="@Url.Action("", "Email")">
         <span class="text-align-l-g">
            <i class="fa fa-inbox"></i>  @MultiLanguage.getText((int)Session[SessionAttributes.LanguageID], SessionVariables.ProjectId, "MyInbox")
            <span class="pull-right">
               <span id="inboxBadge" class="badge badge-warning">@MyInbox</span>
            </span>
         </span>
      </a>
   </div>

0 个答案:

没有答案