-
Notifications
You must be signed in to change notification settings - Fork 161
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
magnified image not displayed correctly if component is not visible when first mounted #30
Comments
thanks for the response! does not seem to make a difference. confirmed that the props were being set (via Inspect --> React) but the div that gets created on hover still had 0px width and height. i've been wondering if it'd be appropriate to call |
Hi @tojvan - I'm surprised you have zero height when configuring small image dimensions. Something I neglected to write in my previous post is to remove or set false the small image property |
@ethanselzer, that restores the zoom function, thanks. i'll have to think about layout some more, however. the images being zoomed are dynamically fetched and will have different aspect ratios. that, and responsive... |
@tojvan - Thanks for the feedback. It may be possible to invoke |
Hi, I came here encountering the same issue. Any work arounds available? Setting small image fluid to false makes the large image goes giant, and zoom now works, but it pops up a very large image on the side. Edit: Using visibility: hidden and visible instead of display: none will do the trick if that's an available option for you guys until the official fix is released. Thanks for an awesome component |
I found a solution in my case where I had inside a map of images
I am sure you can find a solution to remount in your case. |
Hello Ethan,
Great work on this library! I'll be happy to provide a fix if you think this is a legit issue. In short, the issue is that the enlarged image does not appear correctly if our component is placed within other UI that has hidden the component when it is first mounted (via
display:none
on an ancestor DOM element).enlargedImagePosition: 'over'
. I thinkAccordion
is usingdisplay:none and block
to toggle visibility of content.smallImageEl/img
element hasoffsetWidth
andoffSetHeight
of0
. As a result, the enlarged image dimensions are also zero and remain there, even when the rim component is finally displayed (by using the Accordion).ReactImageMagnify.js
doesn't get called when the rim component comes into view. I tried to force matters by callingsetSmallImageDimensionState
when the user clicks to expand an Accordion element but it doesn't help, probably because the event gets called before the offset dimensions of theimg
element have updated.Before thinking of other ways to trigger
setSmallImageDimensionState
, I should ask if this is user error on my part...The text was updated successfully, but these errors were encountered: