0

I'm working on Magento2.3.3 CE.

The Magento2 default magnifier is working fine on the PDP page. I have used the below code for implementing the magnifier in my custom theme.

<var name="magnifier"> <var name="fullscreenzoom">20</var> <var name="top"></var> <var name="left"></var> <var name="width"></var> <var name="height"></var> <var name="eventType">click</var> <var name="enabled">false</var> </var>

The magnifier widget was opened once I click on the product image (default behavior).

But my requirement is, I will add a zoom icon on the product image. So when I click on the icon only the magnifier widget needs open. Otherwise the magnifier no need to be open.

I have tried by editing the magnifier.js (lib/web/magnifier/magnifier.js) Line number: 388

function clickEvents(thumb) {
    $(".zoom-icon-img").on('click', function (e) {

        if (showWrapper) {
            if (!isOverThumb) {
                if (magnifierOptions.status !== 0) {
                    onThumbLeave();
                }
                handleEvents(e);
                isOverThumb = true;
            }
        }
    });
}

Here, zoom-icon-img is the class of the zoom icon image. But it throws some js error.

Thanks in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.