Last active
May 18, 2023 14:45
-
-
Save zackpyle/92f321a8fe32b9c6ba1e326c85e33c64 to your computer and use it in GitHub Desktop.
ACF Repeater + Hide/Show jQuery #acf #beaverbuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
// Hide all expanded steps | |
$('.expandedstep').hide() | |
//Show expanded steps while in the builder | |
$('html.fl-builder-edit .expandedstep').show(); | |
// When an expand step button is clicked | |
$('.expandstepbtn').on('click', function(e) { | |
e.preventDefault(); | |
// Change Text for Expand Button | |
var stepbtntxtchange = $('.expandedstep').is(':visible') ? 'Expand' : 'Collapse'; | |
$(this).text(stepbtntxtchange); | |
// Toggle the next adjacent sibling | |
$(this).next('.expandedstep').slideToggle(250); | |
}); | |
}); | |
/* This is an ACF repeater HTML for Beaver Builder/Themer */ | |
[wpbb-acf-repeater name='REPEATER_FIELD_NAME'] | |
<div class="projectstep"> | |
/* Always Displays */ | |
[wpbb post:acf type='text' name='project_step'] | |
/* Expands after button is clicked */ | |
<button class="expandbtn">Expand</button> | |
<div class="expandedstep"> | |
[wpbb post:acf type='text' name='expanded_project_step'] | |
</div> | |
</div> | |
[/wpbb-acf-repeater] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment