Skip to content
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

load() fails to retrieve image width and height correctly when styling images with CSS #37

Open
edtamarin opened this issue Apr 18, 2019 · 0 comments

Comments

@edtamarin
Copy link

I have a web page where several images are rendered in a tabbed view. On page load the image in the default tab is being processed correctly. However, when the tab is switched, the width and height values are corrupted, with width returning 80 and height returning NaN.

I suspect the issue might arise from the fact that my images have no explicit width and height tag; rather, width and height are defined in CSS using width:80%; height: auto'. The return values from the CSS resemble the corrupted ones (80% and auto-> 80 andNaN. Perhaps the getComputedStyle` function cannot parse the values correctly.

This is supported by the fact that when I declared width and height explicitly in the img tag, the issue went away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant