Open all accordion windows at the same time

后端 未结 3 643
深忆病人
深忆病人 2021-01-21 17:30

I am using jQuery accordion plugin for my application. Is there a way to open sections at the same time(after page has loaded) so that contents of all pages are shown at the sam

3条回答
  •  我在风中等你
    2021-01-21 17:58

    You should read NOTES in this page. Here I copy and pasted it directly from that page:

    NOTE: If you want multiple sections open at once, don't use an accordion

    An accordion doesn't allow more than one content panel to be open at the same time, and it takes a lot of effort to do that. If you are looking for a widget that allows more than one content panel to be open, don't use this. Usually it can be written with a few lines of jQuery instead, something like this:

    jQuery(document).ready(function(){
        $('.accordion .head').click(function() {
            $(this).next().toggle();
            return false;
        }).next().hide();
    });
    

    Or animated:

    jQuery(document).ready(function(){
        $('.accordion .head').click(function() {
            $(this).next().toggle('slow');
            return false;
        }).next().hide();
    });
    

提交回复
热议问题