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

169
Views
Múltiples superposiciones, haga clic con el botón derecho en guardar solo guarde uno

Novato aquí, experimentando. Estoy tratando de crear en html/javascript una sola imagen apilando capas seleccionadas al azar (ver el código a continuación). Sin embargo, cuando hago clic con el botón derecho en la imagen, solo se guarda la capa superior, no todas las capas. ¿Cómo soluciono esto (sería posible un botón si no usa ninguna biblioteca, lo mismo ocurre con las capturas de pantalla)?

¡Muchas gracias de antemano!

Patrón

 //html <div><div id="layers"></div> <canvas id="canvas1"></canvas> // script //create and attach layer1 to body; var img = document.createElement('img'); img.alt = "Layer1"; img.src = layer1_array[getRandomInt(0,3)]; img.setAttribute("id","myImg"); img.style.decoding = "async"; document.getElementById("layers").appendChild(img); //create and attach layer1 to body; var img = document.createElement('img'); img.alt = "Layer2"; img.src = layer2_array[getRandomInt(0,3)]; img.setAttribute("id","myImg"); img.style.decoding = "async"; document.getElementById("layers").appendChild(img);
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

(async () => { innerImage(0); innerImage(1); innerImage(2); })()
about 4 years ago · Juan Pablo Isaza Report

0

<script> const canvas = document.querySelector('canvas'); const ctx = canvas.getContext("2d"); const arrayImage = ["./img/img1.png", "./img/img2.png", "./img/img3.png"]; const innerImage = (index) => { const image = new Image(canvas.width, canvas.height); image.addEventListener("load", () => { ctx.drawImage(image, 0, 0); }); image.src = arrayImage[index]; }; innerImage(0); innerImage(2); innerImage(1); </script>
about 4 years ago · Juan Pablo Isaza Report
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!