Skip to content

Instantly share code, notes, and snippets.

@kprimdal-dk
Last active December 19, 2015 13:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kprimdal-dk/5960690 to your computer and use it in GitHub Desktop.
Save kprimdal-dk/5960690 to your computer and use it in GitHub Desktop.
(function ($) {
"use strict";
$(function() {
$('.more .more-trigger').on('click', function(e) {
var $this = $(this),
text = $this.hasClass('open') ? 'more' : 'less';
$this
.text( text )
.toggleClass('open')
.closest('.more')
.find('.more-content')
.stop()
.slideToggle(300);
});
});
}(jQuery));
add_shortcode( 'more', 'moreShortcode' );
function moreShortcode( $atts, $content ) {
ob_start();
?>
<div class="more">
<div class="more-content" style="display:none;">
<?= $content ?>
</div>
<div class="more-line">
<div class="more-trigger">more</div>
</div>
</div>
<?php
return ob_get_clean();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment