text: let galleryImages = document.querySelectorAll('#gallery div')
  let lastImg
  
  
  galleryImages.forEach(function(e, index){
      e.onclick = function(){
          let imgUrl = window.getComputedStyle(e).getPropertyValue('background-image')
          let newUrl = imgUrl.match(/.*\/(.*\.jpg)/)[1]
          lastImg = index
          setFullscreen(newUrl)
      }
  })
  
  
  function setFullscreen(url){
      let overlay = document.createElement('div')
      overlay.setAttribute('class', 'overlay fullscreen')
      overlay.setAttribute('onclick', 'this.remove(); console.log(this)')
  
      let leftArrow = document.createElement('a')
      leftArrow.setAttribute('id', 'triangle-left')
      leftArrow.setAttribute('onclick', 'changeImage(this.id); event.stopPropagation()')
  
      let rightArrow = document.createElement('a')
      rightArrow.setAttribute('id', 'triangle-right')
      rightArrow.setAttribute('onclick', 'changeImage(this.id); event.stopPropagation()')
  
      let picture = document.createElement('img')
      picture.setAttribute('src', 'img/' + url)
      
      overlay.appendChild(leftArrow)
      overlay.appendChild(picture)
      overlay.appendChild(rightArrow)
      
      document.body.appendChild(overlay)
  }
  
  
  function changeImage(arrow){
      let img = document.querySelector('.overlay.fullscreen img')
      let newImg
  
      if (arrow == 'triangle-left'){
          if (lastImg == 0){
              newImg = galleryImages[galleryImages.length - 1]
              lastImg = galleryImages.length - 1
          }
  
          else{
              newImg = galleryImages[lastImg - 1]
              lastImg -= 1
          }
      }
  
      else if (arrow == 'triangle-right'){
          if (lastImg == galleryImages.length - 1){
              newImg = galleryImages[0]
              lastImg = 0
          }
  
          else{
              newImg = galleryImages[lastImg + 1]
              lastImg += 1
          }
      }
  
      let imgUrl = window.getComputedStyle(newImg).getPropertyValue('background-image')
      let newUrl = imgUrl.match(/.*\/(.*\.jpg)/)[1]
      img.setAttribute('src', 'img/' + newUrl)
  }