jQuery UI Accordion - Keep panel open according to page

℡╲_俬逩灬. 提交于 2020-01-25 07:09:13

问题


jQuery UI's Accordion widget has the active option to keep a certain panel open, but I'm trying to find a way to do this dynamically.

In other words, I want to have a panel open when it corresponds with the page.

HTML:

      <ul id="nav-side" class="accordion">
        <li class="accordion-title"><a href="#">RPO</a>
            <ul>
            <li><a href="/services/direct/rpo/index.php">Value</a></li>
            <li><a href="/services/direct/rpo/solution-competencies.php">Solution Competencies</a></li>
            <li><a href="/services/direct/rpo/rpo-models.php">Defined RPO Models</a></li>
            <li><a href="/services/direct/rpo/program-management.php">Dedicated Program Management</a></li>
            <li><a href="/services/direct/rpo/solution-planning.php">Solution Planning &amp; Implementation</a></li>
          </ul>
        </li>
        <li class="accordion-title"><a href="#">CONSULTING</a>
            <ul>
            <li><a href="/services/direct/consulting/index.php">#</a></li>
            <li><a href="#">#</a></li>
            <li><a href="#">#</a></li>
          </ul>
        </li>
        <li class="accordion-title"><a href="#">CRM</a>
            <ul>
            <li><a href="#">#</a></li>
            <li><a href="#">#</a></li>
            <li><a href="#">#</a></li>
          </ul>
        </li>
      </ul>

So if the user is in the RPO section, the first panel would be open. If in the Consulting section, the second panel would be open.

来源:https://stackoverflow.com/questions/23817904/jquery-ui-accordion-keep-panel-open-according-to-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!