take a screen shot of a image within a div using js

Solutions on MaxInterview for take a screen shot of a image within a div using js by the best coders in the world

showing results for - "take a screen shot of a image within a div using js"
Gustave
09 May 2016
1<!doctype html>
2<html>
3 <head>
4  <script type="text/javascript" src="html2canvas-master/dist/html2canvas.js"></script>
5 </head>
6 <body>
7  <h1>Take screenshot of webpage with html2canvas</h1>
8  <div class="container" id='container' >
9   <img src='images/image1.jpg' width='100' height='100'>
10   <img src='images/image2.jpg' width='100' height='100'>
11   <img src='images/image3.jpg' width='100' height='100'>
12  </div>
13  <input type='button' id='but_screenshot' value='Take screenshot' onclick='screenshot();'><br/>
14
15  <!-- Script -->
16  <script type='text/javascript'>
17  function screenshot(){
18    html2canvas(document.body).then(function(canvas) {
19    document.body.appendChild(canvas);
20   });
21  }
22  </script>
23
24 </body>
25</html>