简体   繁体   中英

hiding a jQuery accordion

I want to have my accordian hide when i click an tag and then have the next one show. this part works right but when the hidden accordian is shown, none of the "drop downs" so to speak, work. When you click the tab, the content is displayed but the tab does not expand to incase it.

<li id="menumenu-3"><a href="#"><img src="../img/menu.png" alt="" /><h3 id="men_t2">Reef Mantis</h3></a></li>

<div id="accordion1">
<h3><a href="#">Info</a></h3>
<div>
    <p>
    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
    ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
    amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
    odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
    </p>
</div>
<div id="accordion2">
<h3><a href="#">Info</a></h3>
<div>
    <p>
    Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
    ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
    amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
    odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
    </p>
</div>

this is the javascript

$('#menumenu-3').click(function(){
    $("#accordion1").fadeOut();
    $("#accordion2").fadeIn();
});

I think you need to use the.Live jquery command to ensure that when you redisplay the accordion that it's wired up again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM