Web Analytics

Fill the form & Get Installation Support





    More/Less functionality in Magento2

    First of all, we need to create several files:

    Let’s review these files and see here description for each one regarding which code will be placed inside of them:

    requirejs-config.js

    Use this file to register your own JavaScript component:

    catalog_product_view.xml

    Inside of the content  container, a new block is created with a specified template file that is going to be used:

    more-less.phtml

    This file contains the basic configuration of the more/less functionality.

    toggle-product-description.js

    Place all of your JavaScript logic in this file. Skeleton of such a JavaScript component should be like this:

    _theme.less

    This is an optional file for you to create, I have created some minimal styling (transparent-to-solid background) as a nice effect on the more/less button.

    Here is how it looks like on the frontend:

    Fill the below form if you have any Magento programming need.





      Recent Articles

      Author Info

      Author Image

      Magento Certified Developer

      Hire J. Lakum

      Get a Free Quote





        Connect With Us