Skip to content

Instantly share code, notes, and snippets.

@p4ulypops
Created January 16, 2014 12:51
Show Gist options
  • Save p4ulypops/8454521 to your computer and use it in GitHub Desktop.
Save p4ulypops/8454521 to your computer and use it in GitHub Desktop.
<button class="replybutton" data-origional="123" data-parent="123">Reply</button>
<script>
$('.replybutton').on('click', function(){
$(this).addClass('loading'); // a class that adds a no-repeat right-aligned background of a spinning giff... give it some padding so it appears 'in the button'.
if ($(this).is(":visible")) {
$("#post" + $(this).data("parent")).slideUp();
} else {
$("#post" + $(this).data("parent")).hide();
$("#post" + $(this).data("parent")).load("/reply?parentPost=" + $(this).data("parent") + "&originalPost=" + $(this).data("origional"), function () {
$("#post" + $(this).data("parent")).slideDown();
$(this).removeClass("loading");
});
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment