I have add tabs in the product view page:
<referenceBlock name="product.info.details">
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description" template="product/view/attribute.phtml" group="detailed_info">
<arguments>
<argument name="at_call" xsi:type="string">getDescription</argument>
<argument name="at_code" xsi:type="string">description</argument>
<argument name="css_class" xsi:type="string">description</argument>
<argument name="at_label" xsi:type="string">none</argument>
<argument name="title" translate="true" xsi:type="string">Details</argument>
</arguments>
</block>
<block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="product/view/attributes.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">More Information</argument>
</arguments>
</block>
</referenceBlock>
is there anyway to made this tabs to remain "sticky" / fixed at the top of the page when we scroll the page?
I try to do like this but is not work:
$(window).scroll(function () {
if( $(window).scrollTop() > $('.product.data.items').offset().top && !($('.product.data.items').hasClass('sticky'))){
$('.product.data.items').addClass('sticky');
} else if ($(window).scrollTop() == 0){
$('.product.data.items').removeClass('sticky');
}
});
Thank you