Comments (9)
Ok, I think I see what the issue is. The zoom plugin is based on the natural width and height of the image. The default zoom magnify multiplier is 1
(100%), so if you are already showing your zoomed image at full size there is no visible change. You can try setting the magnify property to a value larger than 1 for the effect to be applied to images already at their full size. For example, using code from your page:
$('img')
.wrap('<span style="display:inline-block"></span>')
.css('display', 'block')
.parent()
.zoom({magnify: 2});
from zoom.
Thank you Jack, that did the trick!
Also, how do I exclude some pictures from the zoom?
This line doesn't seem to do it:
$('#pic1').trigger('zoom.destroy');
Is it because the javascript setting on the img element overrides this?
from zoom.
You are assigning zoom to the parent element, so you would do this instead:
$('#pic1').parent().trigger('zoom.destroy');
However, it would be better to exclude images before assigning:
$('img:not(#pic1)')
.wrap('<span style="display:inline-block"></span>')
.css('display', 'block')
.parent()
.zoom({magnify: 2});
My advice would be to give the images you want to use zoom with their own class, so that it's opt-in rather than opt-out.
from zoom.
Hey Jack, one last question. I'm new to this. I have already given the images I want to use zoom with their own class. How do I incorporate it into the javascript?
from zoom.
The zoom images automatically get a class of "zoomImg" when they are put on the page.
from zoom.
Right, but he said his advice would be to give the images you want to use zoom with their own class, so that it's opt-in rather than opt-out. I'm trying to only use zoom on certain images on the page. Right now I have it setup so any img element gets the zoom (below), and trying to figure out how to insert the class that I setup into that code so that only images with the class then get the class zoomImg.
$(document).ready(function(){
$('img')
.wrap('<span style="display:inline-block"></span>')
.css('display', 'block')
.parent()
.zoom({magnify:1.5});
});
from zoom.
Oh I see! You just need to modify your selector.
$(document).ready(function(){
$('.yourNewClass')
.wrap('<span style="display:inline-block"></span>')
.css('display', 'block')
.parent()
.zoom({magnify:1.5});
});
from zoom.
Ha, wow, okay thank you!
from zoom.
You are welcome.
from zoom.
Related Issues (20)
- Image missing alt text HOT 1
- Add 'backgroundColor" option when using .zoom with img elements for transparent images
- Trouble in initializing zoom in Vue HOT 5
- onZoomOut bug HOT 1
- How to import this plugin? HOT 1
- Zoom not working with WooCommerce Additional Variation Images
- a bug on zoom out
- Important accessibility issue! No alt text HOT 1
- Version compatibility with 3.4.x
- Accounts stayed sign in HOT 1
- SOUND ISSUE HOT 1
- Cannot set property 'zoom' of undefined in vue HOT 1
- (question) how can i using with "<div> HOT 1
- Show a smaller image (logo) on top of the preview image? HOT 1
- Not Working in angular - $img.stop()
- png image with transparent background HOT 1
- It seems that there is a conflict between zoom and Boost Strap style dropdown. Only one of them can exist
- Want to know something
- magnify value bind to input range
- Magnify the image to the right side instead of image zoom-in in the image frame
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 zoom.