-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zoom on hover #31
Comments
No, I think zoom on hover would cause poor user experience and inconsistent behavior between desktop and touch device. |
@timrombergjakobsson However, you can achieve this by simply adding an event listener to your images, then use API to open up the image. Something like this: const zooming = new Zooming()
// listen() takes either a single Element or, in this case, a CSS selector
zooming.listen('.zoomable')
const zoomable = document.getElementsByClassName('zoomable')
for (let i = 0; i < zoomable.length; i++) {
const img = zoomable[i]
img.addEventListener('mouseenter', function onMouseEnter (event) {
zooming.open(event.target)
})
img.addEventListener('mouseleave', function onMouseLeave (event) {
zooming.close()
})
} |
Ok, thanks! |
Hm weird, I tried your example I only get |
@timrombergjakobsson Here is a working example. I updated the previous comment as well. |
@kingdido999 Thanks a lot! |
About example |
Hi, is there any possibility to zoom in on high res image on hover? I've only found on click. Thanks!
The text was updated successfully, but these errors were encountered: