Comments (7)
No, I think zoom on hover would cause poor user experience and inconsistent behavior between desktop and touch device.
from zooming.
@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()
})
}
from zooming.
Ok, thanks!
from zooming.
Hm weird, I tried your example I only get Uncaught TypeError: zooming.listen is not a function
? I tried console loging the instance of Zooming and its there but the function listen does not seem to exist?
from zooming.
@timrombergjakobsson Here is a working example. I updated the previous comment as well.
from zooming.
@kingdido999 Thanks a lot!
from zooming.
About example
When photo was zoomed via hover event if you begin to grab and your mouse is outside of image, photo is zooming out and it doesn't work anymore. It works only after reload a page.
How to fix it?
from zooming.
Related Issues (20)
- Seeking Maintainers HOT 2
- there is differents between 2 situations HOT 1
- it did not work for me HOT 2
- Can I have more control over when zoom closes?
- Acess the template wrapper HOT 1
- zooming videos HOT 4
- Images are not zoomed in the center of the viewport when document is displayed within an iframe HOT 3
- Strange behavior when zoom animation is activated HOT 3
- further zoom in HOT 5
- Add option for cursor customization HOT 1
- Scale to full size of high res image. HOT 1
- Add config option to specify parent container for overlay
- click once to resize HOT 4
- Thanks for an excellent tool! HOT 1
- Closing on scroll doesn't occur as expected
- Implement event delegation!
- No zooming when img as link HOT 2
- Add an id to zoomed image or zoom div?
- Grab Strength/Distance
- Bug encountered when using zooming.js in Vue.js.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zooming.