elevatezoom icon indicating copy to clipboard operation
elevatezoom copied to clipboard

How to change img and zoom img on click event?

Open raysefo opened this issue 9 years ago • 4 comments

Hello guys,

I would like to know if there is a way to change the src and data-zoom-image when user clicks on a specific html tag on the page?

HTML:

Javascript: $(document).ready(function () { $("#zoom").elevateZoom({ zoomType: "inner", cursor: "crosshair", zoomWindowFadeIn: 500, zoomWindowFadeOut: 500 }); });

Thanks in advance & Best Regards.

raysefo avatar Jan 04 '16 06:01 raysefo

Here is the html tag: <img id="zoom" src="images/sw.png" data-zoom-image="images/sw_.jpg" width="450" height="253"/>

raysefo avatar Jan 04 '16 07:01 raysefo

I can change the zoom image as follows but how can I change image and zoom image both? ` $(document).ready(function () { $("#tr").click(function () {

            $("#zoom").data('zoom-image', 'images/libelium_smart_world.jpg').elevateZoom({
                zoomType: "inner",
                cursor: "crosshair",
                responsive: "true"

            });
        });
    });`

raysefo avatar Jan 05 '16 06:01 raysefo

Türkçe English
</div>

$(document).ready(function () { $("#eng").click(function () { $('#zoom').attr('src', 'images/libelium_smart_world.png'); $("#zoom").data('zoom-image', 'images/libelium_smart_world.jpg').elevateZoom({ zoomType: "inner", cursor: "crosshair", responsive: "true"

            });
        });
        $("#tr").click(function () {
            $('#zoom').attr('src', 'images/sw.png');
            $("#zoom").data('zoom-image', 'images/sw_.jpg').elevateZoom({
                zoomType: "inner",
                cursor: "crosshair",
                responsive: "true"

            });
        });
    });

chandrantwins avatar Feb 20 '20 09:02 chandrantwins

Thanks, the @raysefo response helped me ♥

omarZaoujal99 avatar May 10 '21 04:05 omarZaoujal99