Line 22: | Line 22: | ||
<script> | <script> | ||
+ | |||
+ | |||
$(document).ready(function () { | $(document).ready(function () { | ||
var parentDivs = $('#nestedAccordion div'), | var parentDivs = $('#nestedAccordion div'), | ||
− | childDivs = $('#nestedAccordion h3').siblings('div') | + | childDivs = $('#nestedAccordion h3').siblings('div'); |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | $('#nestedAccordion h2'). | + | $('#nestedAccordion h2').click(function () { |
− | + | ||
parentDivs.slideUp(); | parentDivs.slideUp(); | ||
− | + | if ($(this).next().is(':hidden')) { | |
− | + | $(this).next().slideDown(); | |
− | } | + | } else { |
+ | $(this).next().slideUp(); | ||
+ | } | ||
}); | }); | ||
− | $('#nestedAccordion h3'). | + | $('#nestedAccordion h3').click(function () { |
− | + | ||
childDivs.slideUp(); | childDivs.slideUp(); | ||
− | + | if ($(this).next().is(':hidden')) { | |
− | + | $(this).next().slideDown(); | |
− | } | + | } else { |
+ | $(this).next().slideUp(); | ||
+ | } | ||
}); | }); | ||
+ | }); | ||
− | + | $('#expand').click(function () { | |
− | + | parentDivs.slideDown(); | |
− | + | childDivs.slideDown(); | |
− | }); | + | return false |
+ | }); | ||
− | + | $('#collapse').click(function () { | |
− | + | parentDivs.slideUp(); | |
− | + | childDivs.slideUp(); | |
− | + | return false | |
}); | }); | ||
− | + | </script> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</html> | </html> |
Latest revision as of 18:05, 28 August 2017
Parent 1
Child 1
Sub 1
Child 2
Sub 2
Parent 2
Child 1
Sub 1