-
Notifications
You must be signed in to change notification settings - Fork 22
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
Use data-original as src #44
Comments
I wonder what's the best way to achieve this. Maybe this is a use case for the |
Did you found a solution? I was able to use data-original by updating zoomImage: function zoomImage() {
var img = document.createElement('img')
img.onload = function () {
fullHeight = Number(img.height)
fullWidth = Number(img.width)
zoomOriginal()
}
// Added here targetImage.getAttribute('data-original')
img.src = targetImage.getAttribute('data-original') || targetImage.currentSrc || targetImage.src
} However, the result it's not the same. Something else is required in zoom calculation, because sometimes the image is attached to edge of window without margin. |
This seem works fine: if (targetImage.getAttribute('data-original')) {
targetImage.src = img.src = targetImage.getAttribute('data-original')
} else {
img.src = targetImage.currentSrc || targetImage.src
} |
@thewebartisan7 thanks for looking into this! How does this behave on the first zoom for a specific image? I suppose it starts downloading the original image after the thumbnail is clicked? |
Yes right. The original images it's not downloaded until you click on thumbnail. |
Got it. I think that's not ideal - one of the nice things about zoom.js is how smoothly it works and having to wait for the original image to download after clicking on the zoom takes away from that, doesn't it? |
How about using the |
Would it be possible to use
data-original
as a src for the zoom?Right now it just zooms the src-size, which would result in a not much bigger/zoomed image when you're working with correct image sizes.
The text was updated successfully, but these errors were encountered: