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

visibility attribute not considered #4

Open
mvrueden opened this issue Jan 19, 2014 · 3 comments
Open

visibility attribute not considered #4

mvrueden opened this issue Jan 19, 2014 · 3 comments

Comments

@mvrueden
Copy link

Hey there,

yesterday I experimented with your lazyload feature.

I realized, that the current code does not check the visibility attribute (e.g. "visibility: hidden").

Here is an example:

<img style="visibility: hidden;" data-frz-src="myImage.jpg" src=data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=== lzld(this) onerror=lzld(this) />

This image got loaded (lazy) even if its not really visible.

I am not sure if there is a reason why it is loaded, even if it is not visible, so I created an issue.

Please let me know, if you need any more information.

Kind regards
mvrueden

@evoactivity
Copy link

This wouldn't actually work for visibility: hidden, but works for display none.

As I'm using jquery already, I've added

&& $(img).is(":visible")

to line 183 in the showIfVisible function, I might implement a vanilla js version that also takes into account visibility and submit a pull request when I get some time, but for now that does the trick nicely for my needs.

@mvrueden
Copy link
Author

Thanks for your input. I do not need that functionality/feature, I just realized "the behaviour" as I experimented with it, and wanted to provide some feedback :)

@evoactivity
Copy link

I still think it'll be useful so once I get some time to look at it I'll make the necessary changes.

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

2 participants