Commit c08a2568 authored by allan's avatar allan

swap expand and collapse buttons on click

parent 0c49c4b9
Pipeline #1484 passed with stage
in 1 second
......@@ -28,7 +28,8 @@ $questions = get_posts( array(
</ul>
<div class="collapse-all-group">
<button class="collapse-all button expand">expand all +</button>
<button class="expand-all button expand"><?php echo pll__('expand all') ?></button>
<button class="collapse-all button collapse" style="display: none;"><?php echo pll__('collapse all') ?></button>
</div>
<ul class="questions accordions">
<?php
......
......@@ -52,10 +52,12 @@
$('.collapse-all-group').on('click', 'button', function() {
if ($(this).context.classList.contains('expand')) {
$('.accordion').addClass('is-active');
$(this).removeClass('expand');
$(this).hide();
$('.collapse').show();
} else {
$('.accordion').removeClass('is-active');
$(this).addClass('expand');
$(this).hide();
$('.expand').show();
}
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment