Skip to content

Instantly share code, notes, and snippets.

@jawinn
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save jawinn/e85df09e8790b72f8480 to your computer and use it in GitHub Desktop.

Select an option

Save jawinn/e85df09e8790b72f8480 to your computer and use it in GitHub Desktop.
View Less Top
$(".view-less-top").on("click", function() {
// find real "View Less" link and trigger a click on it
$closestTrigger = $(this).parent('h2').parent('.testimonial').find('.maxlist-more a');
$closestTrigger.trigger("click");
// set text the same, if in expanded state. else set to blank.
if ( $closestTrigger.hasClass('less') ) {
$(this).text( $closestTrigger.text() );
} else {
$(this).text('');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment