jackmoore / zoom

jQuery plugin for zooming images on mouseover.
http://www.jacklmoore.com/zoom/
MIT License
1.54k stars 460 forks source link

zoom not working in more than five images, with same class or id #132

Closed sagargc closed 6 years ago

sagargc commented 6 years ago

How to fix this issues if i use saveral images more than five, thank you.

jackmoore commented 6 years ago

The HTML spec mandates that IDs be unique, so additional elements you've assigned that same ID to are not going to be accessed when you try to use that ID as a DOM query selector. Use a class if you want to access multiple elements using the same selector.

sagargc commented 6 years ago

here is a link http://sagarandbrothers.com.np/ebook/test.php

jackmoore commented 6 years ago

If you post a link to a live demo I'll have a look, otherwise I think it's going to be hard to diagnose your problem.

sagargc commented 6 years ago

link is here http://sagarandbrothers.com.np/ebook/test.php thank you...

sagargc commented 6 years ago

if i addred more pages after 5th page, like 6th 7th and so on not working...

jackmoore commented 6 years ago

It looks like zoom is working with all the elements it was assigned to. Here is your markup for the <img> elements:

<div class="book" id="book" style="background: #fff">                      
     <div class="page zoom">
         <img src="pages/1.png" alt="" />
     </div>
     <div class="page zoom">
         <img src="pages/2.png" alt="" />
     </div>
     <div class="page zoom">
         <img src="pages/3.png" alt="" />
     </div>
     <div class="page zoom">
         <img src="pages/4.png" alt="" />
     </div>
     <div class="page zoom">
         <img src="pages/5.png" alt="" />
     </div>
     <div class="page zoom">
         <img src="pages/5.png" alt="" />
     </div>
</div>

So the flipbook feature goes through those defined elements fine, but it continues onto a 6th page which doesn't seem to have corresponding .page element in the DOM. I'm not going to go through the code to find where it gets the 6th page from, but it's not the same DOM nodes as zoom was assigned to. From what I can tell zoom is working correctly for elements that exist at the time it was assigned.

sagargc commented 6 years ago

thank you for your kind response.