Created
April 9, 2020 20:56
-
-
Save jpjuliao/a0415af71248f35b1a56dfb6e59712ca to your computer and use it in GitHub Desktop.
HTML element to image via JS
This file contains 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
// jQuery.getScript('https://github.com/tsayen/dom-to-image/blob/master/dist/dom-to-image.min.js'); | |
// jQuery.getScript('https://raw.githubusercontent.com/eligrey/FileSaver.js/master/dist/FileSaver.min.js'); | |
(function($){ | |
function download(elem) { | |
domtoimage.toBlob( | |
elem, | |
{ | |
height: 343.47, | |
width: 343.47, | |
} | |
).then(function(blob) { | |
window.saveAs(blob, "my-node.jpeg"); | |
}); | |
} | |
$('.uabb-photo-gallery-content.chs, .uabb-photo-gallery-content.reba').each(function(i, elem){ | |
// if (i > 5) return; | |
// if (i < 15 && i > 20) return; | |
download( elem ); | |
}); | |
})(jQuery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment