简体   繁体   中英

Jquery Image Zoom for All Images

I found a jquery image zoom plugin on the web ( http://www.elevateweb.co.uk/image-zoom ) but I have more than 200 small images that I would like to apply this plugin. I think I need to track mouse on elevatezoom.js, how can I do that?

HTML

<img id="zoom_01" src="image1.png" data-zoom-image="image1.jpg"/>

Script

<script> $("#zoom_01").elevateZoom(); </script>

(elevatezoom.js file can be found on http://www.elevateweb.co.uk/download-file )

Try something like this:

First, give a .class to handle all images

<img class="image-to-zoom" 
     id="zoom_01" src="image1.png" data-zoom-image="image1.jpg"/>

Then, attach to the .class the mouseover event to trigger elevateZoom() on the element has the mouse hover

$('.image-to-zoom').on('mouseover',function(){
    //This element is being 'mouseovered', so trigger the plugin
    $(this).elevateZoom();
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM