templates/product/public/show.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}
  3.   {{ product.name }}
  4. {% endblock %}
  5. {% block body %}
  6.   {% include 'product/public/_show.html.twig' %}
  7.   <script>
  8.     const imgList = document.querySelectorAll('.img-item')
  9.     const imgBox = document.querySelector('.box')
  10.     const gallery = document.querySelector('#gallery')
  11.     if (!gallery) {
  12.       imgList.forEach((img) => {
  13.         img.addEventListener('click', () => {
  14.           imgBox.src = img.src
  15.         })
  16.       })
  17.     }
  18.   </script>
  19. {% endblock %}