fat / zoom.js

Medium's Image Zoom for jQuery
https://fat.github.io/zoom.js
MIT License
4.04k stars 332 forks source link

Link to zoom.js must be at end of doc not in head #34

Closed carmi closed 9 years ago

carmi commented 9 years ago

I was having a bit of trouble getting zoom.js to work, and it seemed like the final reason was I was placing my link to zoom.js in not at the end of the body -- after the img's with the data-action="zoom". My understanding (could be wrong) is that when the script is loaded it immediately adds a on click listener to each of those elements. So you can't place it in the head. This makes sense, but if correct, I think adding a but of clarification to docs would be helpful. I'll add those clarifications to the docs, but wanted to check that this was correct before sending a PR with the changes. Thanks!

bravokiloecho commented 9 years ago

I think this is right too. I've submitted a pull request (#31) that would resolve this issue by initialising the plugin within a document ready listener.

carmi commented 9 years ago

Oh yeah, dur! that's a smarter way to handle this! Thanks @bravokiloecho

fat commented 9 years ago

this was fixed, thanks