1xptolevitico69

CreateElement ( image ) - display array ( pics )

Oct 25th, 2020
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.02 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>CreateElement ( image ) - display array ( pics )
  5. </title>
  6. <meta charset="utf-8">
  7. <meta name="viewport" content="width=device-width">
  8. <style>
  9.  
  10.  
  11. .image {
  12.   width: 200px;
  13.   height: 200px;
  14.   border: 5px solid;
  15.   position: absolute;
  16.   top: 10px;
  17.   left: 10px;
  18. }
  19. #demo {
  20.   width: 200px;
  21.   height: 200px;
  22.   border: 5px solid black;
  23.   display: none;
  24.   font-size: 25px;
  25.   font-family: arial black;
  26.   color: red;
  27.   display: grid;
  28.   place-items: center;
  29.   position: absolute;
  30.   top: 10px;
  31.   left: 10px;
  32.   text-align: center;
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40. </style>
  41. </head>
  42. <body>
  43.  
  44.  
  45. <span id='demo'>
  46.   <span>No more pics to show</span>
  47. </span>
  48.  
  49.  
  50.  
  51.  
  52.  
  53. <script>
  54.  
  55.  
  56. i = 0;
  57.  
  58. array = [
  59.   "https://image.freepik.com/free-vector/girl-with-balloons-cartoon_23-2147502477.jpg",
  60.   "https://preview.free3d.com/img/2014/03/2202346574644774419/qjjknje9-900.jpg",
  61.   "https://www.clipartkey.com/mpngs/m/4-41440_potato-clipart-for-download-free-potato-cartoon.png",
  62.   "https://preview.free3d.com/img/2014/03/2202346574644774419/qalvpuff-900.jpg",
  63.   "https://images.all-free-download.com/images/graphicthumb/potato_sale_drawing_female_seller_display_icons_6832084.jpg",
  64.   "https://www.kindpng.com/picc/m/104-1044929_jacket-potato-cartoon-character-free-picture-potato-with.png",
  65.   "https://preview.free3d.com/img/2014/03/2202346574644774419/q2j4fh4w-900.jpg",
  66.   "https://images.all-free-download.com/images/graphicthumb/girls_balloons_background_colorful_cartoon_drawing_6827688.jpg",
  67.   "https://vectorified.com/image/potato-vector-1.jpg"
  68. ];
  69. image = document.createElement("img");
  70. document.body.appendChild(image);
  71. image.className = "image";
  72. image.src = array[i];
  73.  
  74. function change() {
  75.   stopInterval = setInterval(function () {
  76.     image.src = array[i];
  77.     i++;
  78.     if (i == array.length) {
  79.       clearInterval(stopInterval);
  80.       setTimeout(function () {
  81.         image.style.display = "none";
  82.       }, 1000);
  83.     }
  84.   }, 1000);
  85. }
  86. change();
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96. </script>
  97. </body>
  98. </html>
Add Comment
Please, Sign In to add comment