2

I would like to show product image changes on mouse over. I mean to call a second image during mouse over in magento2.

2
  • On catalog list page or in product page?
    – Anitr
    Dec 13, 2016 at 9:02
  • Hello You did it?
    – Tushar
    Sep 7, 2020 at 11:01

1 Answer 1

0

In your theme under

app/design/frontend/themePackage/themeName/Magento_Theme/layout/

create catalog_category_view.xml (for category page) and/or catalog_product_view.xml (for product page) and/or catalogsearch_result_index.xml (for search result page) and add in this code:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <script src="js/your-script.js" />
        <css src="css/your-css.css" />
    </head>
</page>

Then you can create your-script.js file under

app/design/frontend/themePackage/themeName/web/js/

and your-css.css under

app/design/frontend/themePackage/themeName/web/css/

Now you can prepare your script to execute instructions on mouse over event.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.