Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
Concatene varios divs y exporte la imagen como png html2canvas

Estoy tratando de concatenar varios divs para tomar una captura de pantalla de mi pantalla con html2canvas. La biblioteca funciona correctamente si uso solo un div como objetivo con html2canvas, pero una vez que trato de concatenar varios div de la forma en que lo codifiqué, la imagen es con el último div agregado. El DOM se altera y todo se mueve hacia abajo.

¿Es la forma correcta de crear divs concatenados para html2canvas?

¿Cómo puedo obtener los resultados esperados? ty

 var screenshot = document.getElementById("screenshotButton"); screenshot.addEventListener("click", function(event) { const captureElement = document.getElementById('cy') const testDiv = document.getElementById('tippy-2') var alpha = document.createElement("div"); alpha.appendChild(captureElement); alpha.appendChild(testDiv); // document.body.appendChild(alpha); html2canvas(alpha) .then(canvas => { crossOriginIsolated = 'anonymous', useCORS= true, foreignObjectRendering= true, allowTaint =false, canvas.style.display = 'none' document.body.appendChild(canvas) return canvas }) .then(canvas => { const image = canvas.toDataURL('image/png').replace('image/png', 'image/octet-stream') const a = document.createElement('a') a.setAttribute('download', 'my-image.png') a.setAttribute('href', image) a.click() canvas.remove() })
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!