src/Eccube/Resource/template/default/Block/nav_sp.twig line 1

Open in your IDE?
  1. {#
  2. This file is part of EC-CUBE
  3. Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  4. http://www.ec-cube.co.jp/
  5. For the full copyright and license information, please view the LICENSE
  6. file that was distributed with this source code.
  7. #}
  8. {% block stylesheet %}
  9. <style>
  10.     .ec-headerNavSP {
  11.         display: none;
  12.         border: 1px solid #eee;
  13.         box-shadow: 1px 1px 1px #c5c5c5;
  14.         font-size: 22px;
  15.         padding: 28px;
  16.     }
  17. </style>
  18. {% endblock %}
  19. <div class="ec-headerNavSP">
  20.     <i class="fas fa-bars"></i>
  21. </div>
  22. {% block javascript %}
  23. <script>
  24.     const spNavModule = () => {
  25.         const spNavAnimation = () => {
  26.             const spNav = document.querySelector('.ec-headerNavSP')
  27.             const navBorderline = 150
  28.             if(window.innerWidth < 768) {
  29.                 window.pageYOffset > navBorderline ?
  30.                 spNav.style.display = "block" :
  31.                 spNav.style.display = "none"
  32.             }
  33.         }
  34.         window.addEventListener('scroll', spNavAnimation)
  35.     }
  36.     const exceptList = ['cart', 'shopping', 'entry', 'contact', 'mypage/login', 'mypage/change', 'mypage/delivery', 'mypage/withdraw']
  37.     const path = location.pathname
  38.     for(let pattern of exceptList) {
  39.         let reg = new RegExp('^\/' + pattern + '.*', 'i')
  40.             result = reg.test(path) ? true : false
  41.         if(result === true) break
  42.     }
  43.     result === false ? spNavModule() : null
  44. </script>
  45. {% endblock %}