Created
January 16, 2014 18:23
-
-
Save ChrisLTD/8460373 to your computer and use it in GitHub Desktop.
ACF Flexible Content layout collapse button
This file contains hidden or 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
| function close_flexible_content(){ | |
| $('.layout').attr('data-toggle', 'closed'); | |
| $('.acf-input-table').css('display', 'none'); | |
| } | |
| function open_flexible_content(){ | |
| $('.layout').attr('data-toggle', 'open'); | |
| $('.acf-input-table').css('display', 'table'); | |
| } | |
| close_flexible_content(); | |
| $('.field_type-flexible_content').prepend('<a class="toggle_flexible_content button button-small" style="float: right; margin-top: -8px;" href="#">Toggle Layout Boxes</a>') | |
| $('body').on('click', '.toggle_flexible_content', function(event){ | |
| event.preventDefault(); | |
| $this = $(this); | |
| if( $this.data('toggle') == 'open' ){ | |
| close_flexible_content(); | |
| $this.data('toggle', ''); | |
| } else { | |
| open_flexible_content(); | |
| $this.data('toggle', 'open'); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment