Skip to content

Instantly share code, notes, and snippets.

@DougManuel
Forked from bearloga/clickable-imgs.js
Created December 6, 2018 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DougManuel/8d00c34960d3a61cd66c51372aa61830 to your computer and use it in GitHub Desktop.
Save DougManuel/8d00c34960d3a61cd66c51372aa61830 to your computer and use it in GitHub Desktop.
Make the figures click-able in your RMarkdown=>HTML reports.
<script language="JavaScript">
$(function() {
/* Lets the user click on the images to view them in full resolution. */
$("div.figure img").wrap(function() {
var link = $('<a/>');
link.attr('href', $(this).attr('src'));
link.attr('title', $(this).attr('alt'));
link.attr('target', '_blank');
return link;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment