Created
May 15, 2015 17:28
-
-
Save atbradley/6e6847db92d08e5cfbd5 to your computer and use it in GitHub Desktop.
Create a link (as a jQuery object) to an SVG on the current page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Via http://stackoverflow.com/a/29579591/76367 | |
function svg_link(svgid) { | |
svg = document.getElementById(svgid); | |
return $('<a/>').attr('href', 'data:image/svg+xml;utf8,' + svg.outerHTML); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment