{% sw_extends '@Storefront/storefront/page/product-detail/index.html.twig' %}
{% block page_product_detail_tabs %}
{# start tabs #}
{# <div class="new-tabs">
<ul>
<li><a href="#nmytab1">Produktbeschreibung</a></li>
<li><a href="#nmytab2">Technische Daten</a></li>
</ul>
</div> #}
<div class="m1 menu">
<div id="menu-center">
<ul>
{% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getAboveProductDetailDescriptionContent() %}
{% for content in page.product.extensions.netiProductCms.getAboveProductDetailDescriptionContent() %}
{%if 'Technische' in content %}
<li><a href="#technische">Technische Daten</a></li>
{% endif %}
{% endfor %}
{% endif %}
{% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getAboveProductDetailDescriptionContent() %}
{% for content in page.product.extensions.netiProductCms.getAboveProductDetailDescriptionContent() %}
{%if 'Kombinierbare' in content %}
<li><a href="#kombinierbare">Kombinierbare Aktionen</a></li>
{% endif %}
{% endfor %}
{% endif %}
{% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getAboveProductDescriptionContent() %}
{% for content in page.product.extensions.netiProductCms.getAboveProductDescriptionContent() %}
{%if 'Kombinierbare' in content %}
<li><a href="#kombinierbare">Kombinierbare Aktionen</a></li>
{% endif %}
{% endfor %}
{% endif %}
{% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getBelowProductDescriptionContent() %}
{% for content in page.product.extensions.netiProductCms.getBelowProductDescriptionContent() %}
{%if 'Kombinierbare' in content %}
<li><a href="#kombinierbare">Kombinierbare Aktionen</a></li>
{% endif %}
{% endfor %}
{% endif %}
<li><a href="#produktbeschreibung">Produktbeschreibung</a></li>
{% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getBelowProductDetailDescriptionContent() %}
{% for content in page.product.extensions.netiProductCms.getBelowProductDetailDescriptionContent() %}
{%if 'Technische' in content %}
<li><a href="#technische">Technische Daten</a></li>
{% endif %}
{% endfor %}
{% endif %}
{% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getAboveProductDescriptionContent() %}
{% for content in page.product.extensions.netiProductCms.getAboveProductDescriptionContent() %}
{%if 'Technische' in content %}
<li><a href="#technische">Technische Daten</a></li>
{% endif %}
{% endfor %}
{% endif %}
{% if page.product.extensions.netiProductCms and page.product.extensions.netiProductCms.getBelowProductDescriptionContent() %}
{% for content in page.product.extensions.netiProductCms.getBelowProductDescriptionContent() %}
{%if 'Technische' in content %}
<li><a href="#technische">Technische Daten</a></li>
{% endif %}
{% endfor %}
{% endif %}
</ul>
</div>
</div>
{# end tabs #}
{# start tab js #}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
let onScroll = function(event){
$('#menu-center a').each(function () {
var scrollPos = $(document).scrollTop();
var currLink = $(this);
var refElement = $(currLink.attr("href"));
scrollPos += 150;
//console.log(refElement.position().top, refElement.height(), scrollPos);
if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
$('#menu-center ul a').parent().removeClass("active");
console.log('position true', refElement);
currLink.parent().addClass("active");
}
else{
currLink.parent().removeClass("active");
}
});
}
$(document).ready(function () {
$(document).on("scroll.custom", onScroll);
//smoothscroll
$('a[href^="#"]').on('click', function (e) {
e.preventDefault();
$(document).off("scroll.custom");
$('a').each(function () {
$(this).parent().removeClass('active');
})
$(this).parent().addClass('active');
var target = this.hash;
e.preventDefault();
var pos = $(this).attr('href');
doScrolling(pos, 1000);
});
});
function doScrolling(element, duration) {
var startingY = window.pageYOffset
var elementY = getElementY(element) + 70
var targetY = document.body.scrollHeight - elementY < window.innerHeight ? document.body.scrollHeight - window.innerHeight : elementY
var diff = (targetY - (130 + 85)) - startingY
var easing = function(t) {
return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1
}
var start
if (!diff)
return
window.requestAnimationFrame(function step(timestamp) {
if (!start)
start = timestamp
var time = timestamp - start
var percent = Math.min(time / duration, 1)
percent = easing(percent)
window.scrollTo(0, startingY + diff * percent)
if (time < duration) {
window.requestAnimationFrame(step);
} else {
$(element).parent().addClass("active").siblings().removeClass("active");
$(document).on("scroll.custom", onScroll);
}
})
}
function getElementY(query) {
return window.pageYOffset + document.querySelector(query).getBoundingClientRect().top
}
</script>
{# end tab js #}
{#<div class="product-detail-tabs tb-pd">
{% sw_include '@Storefront/storefront/page/product-detail/tabs.html.twig' %}
</div> #}
{% endblock %}