custom/plugins/CustomContentPdp/src/Resources/views/storefront/page/product-detail/index.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/page/product-detail/index.html.twig' %}
  2. {% block page_product_detail_tabs %}
  3.  
  4. {# start tabs #}
  5.             {# <div class="new-tabs">
  6.               <ul>
  7.                 <li><a href="#nmytab1">Produktbeschreibung</a></li>
  8.                 <li><a href="#nmytab2">Technische Daten</a></li>
  9.               </ul>
  10.             </div> #}
  11.             <div class="m1 menu">
  12.             <div id="menu-center">
  13.                 <ul>
  14.               
  15.     {% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getAboveProductDetailDescriptionContent() %}
  16. {% for content in page.product.extensions.netiProductCms.getAboveProductDetailDescriptionContent() %}
  17. {%if 'Technische' in content %}
  18. <li><a href="#technische">Technische Daten</a></li>
  19. {% endif %} 
  20. {% endfor %}
  21. {% endif %}
  22. {% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getAboveProductDetailDescriptionContent() %}
  23. {% for content in page.product.extensions.netiProductCms.getAboveProductDetailDescriptionContent() %}
  24. {%if 'Kombinierbare' in content %}
  25. <li><a href="#kombinierbare">Kombinierbare Aktionen</a></li>
  26. {% endif %} 
  27. {% endfor %}
  28. {% endif %}
  29. {% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getAboveProductDescriptionContent() %}
  30. {% for content in page.product.extensions.netiProductCms.getAboveProductDescriptionContent() %}
  31. {%if 'Kombinierbare' in content %}
  32. <li><a href="#kombinierbare">Kombinierbare Aktionen</a></li>
  33. {% endif %} 
  34. {% endfor %}
  35. {% endif %}
  36. {% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getBelowProductDescriptionContent() %}
  37. {% for content in page.product.extensions.netiProductCms.getBelowProductDescriptionContent() %}
  38. {%if 'Kombinierbare' in content %}
  39. <li><a href="#kombinierbare">Kombinierbare Aktionen</a></li>
  40. {% endif %} 
  41. {% endfor %}
  42. {% endif %}
  43.                    
  44.                     <li><a href="#produktbeschreibung">Produktbeschreibung</a></li>
  45.                     
  46.                     
  47. {% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getBelowProductDetailDescriptionContent() %}
  48. {% for content in page.product.extensions.netiProductCms.getBelowProductDetailDescriptionContent() %}
  49. {%if 'Technische' in content %}
  50. <li><a href="#technische">Technische Daten</a></li>
  51. {% endif %} 
  52. {% endfor %}
  53. {% endif %}
  54. {% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getAboveProductDescriptionContent() %}
  55. {% for content in page.product.extensions.netiProductCms.getAboveProductDescriptionContent() %}
  56. {%if 'Technische' in content %}
  57. <li><a href="#technische">Technische Daten</a></li>
  58. {% endif %} 
  59. {% endfor %}
  60. {% endif %}
  61. {% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getBelowProductDescriptionContent() %}
  62. {% for content in page.product.extensions.netiProductCms.getBelowProductDescriptionContent() %}
  63. {%if 'Technische' in content %}
  64. <li><a href="#technische">Technische Daten</a></li>
  65. {% endif %} 
  66. {% endfor %}
  67. {% endif %}
  68.                 </ul>
  69.             </div>
  70.         </div>
  71.             
  72.             {# end tabs #}
  73.             {# start tab js #}
  74.               <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  75.               <script>
  76.              
  77.                 let onScroll = function(event){
  78.    
  79.                 $('#menu-center a').each(function () {
  80.                     var scrollPos = $(document).scrollTop();
  81.                     var currLink = $(this);
  82.                     var refElement = $(currLink.attr("href"));
  83.                     scrollPos += 150;
  84.                     //console.log(refElement.position().top, refElement.height(), scrollPos);
  85.                     if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
  86.                         $('#menu-center ul a').parent().removeClass("active");
  87.                         console.log('position true', refElement);
  88.                         currLink.parent().addClass("active");
  89.                     }
  90.                     else{
  91.                         currLink.parent().removeClass("active");
  92.                     }
  93.                 });
  94.             }
  95.             $(document).ready(function () {
  96.                 $(document).on("scroll.custom", onScroll);
  97.                 
  98.                 //smoothscroll
  99.                 $('a[href^="#"]').on('click', function (e) {
  100.                     e.preventDefault();
  101.                     $(document).off("scroll.custom");
  102.                     
  103.                     $('a').each(function () {
  104.                         $(this).parent().removeClass('active');
  105.                     })
  106.                     $(this).parent().addClass('active');
  107.                 
  108.                     var target = this.hash;
  109.                 e.preventDefault();
  110.                         var pos = $(this).attr('href');
  111.                         doScrolling(pos, 1000);
  112.                     
  113.                 });
  114.             });
  115.         function doScrolling(element, duration) {
  116.             var startingY = window.pageYOffset
  117.             var elementY = getElementY(element) + 70
  118.             var targetY = document.body.scrollHeight - elementY < window.innerHeight ? document.body.scrollHeight - window.innerHeight : elementY
  119.             var diff = (targetY - (130 + 85)) - startingY
  120.             var easing = function(t) {
  121.                 return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1
  122.             }
  123.             var start
  124.             if (!diff)
  125.                 return
  126.             window.requestAnimationFrame(function step(timestamp) {
  127.                 if (!start)
  128.                     start = timestamp
  129.                 var time = timestamp - start
  130.                 var percent = Math.min(time / duration, 1)
  131.                 percent = easing(percent)
  132.                 window.scrollTo(0, startingY + diff * percent)
  133.                 if (time < duration) {
  134.                     window.requestAnimationFrame(step);
  135.                 } else {
  136.                     $(element).parent().addClass("active").siblings().removeClass("active");
  137.                      $(document).on("scroll.custom", onScroll);
  138.                 }
  139.             })
  140.         }
  141.          function getElementY(query) {
  142.             return window.pageYOffset + document.querySelector(query).getBoundingClientRect().top
  143.         }
  144.         </script>
  145.     {# end tab js #}
  146.               
  147.               
  148.     {#<div class="product-detail-tabs tb-pd">
  149.         {% sw_include '@Storefront/storefront/page/product-detail/tabs.html.twig' %}
  150.     </div> #}
  151. {% endblock %}