Skip to content

Instantly share code, notes, and snippets.

@domagude
Created October 29, 2017 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save domagude/3e8b8d58ade7cb5cc0312c17c2e36d76 to your computer and use it in GitHub Desktop.
Save domagude/3e8b8d58ade7cb5cc0312c17c2e36d76 to your computer and use it in GitHub Desktop.
$(document).on('turbolinks:load', function() {
// when a post is clicked, show its full content in a modal window
$("body").on( "click", ".single-post-card, .single-post-list", function() {
var posted_by = $(this).find('.post-content .posted-by').html();
var post_heading = $(this).find('.post-content h3').html();
var post_content = $(this).find('.post-content p').html();
var interested = $(this).find('.post-content .interested').attr('href');
$('.modal-header .posted-by').text(posted_by);
$('.loaded-data h3').text(post_heading);
$('.loaded-data p').text(post_content);
$('.loaded-data .interested a').attr('href', interested);
$('.myModal').modal('show');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment