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

offsetWidth and offsetHeight always 0 when using bLazy in ajax request. #22

Closed
shaughnlgh opened this issue May 29, 2014 · 4 comments
Closed

Comments

@shaughnlgh
Copy link

v1.2.2
The offsetWidth and offsetHeight always returns 0 when using bLazy in an ajax request.

I know that the offset values will return 0 when the element = display:none; however this is not the case.

Whats happening is the following:
line 130

"if(ele.offsetWidth > 0 && ele.offsetHeight > 0) {

If these values are 0, then the image preloader keep loading forever and the image element never gets updated with the actual source.

by removing line 130 and 156, i managed to resolve the issue and everything works as expected, however im not sure what this check is actually for or if it should even be there as there is no else statement allowing to update or notify that there was an issue.

Regards
Shaughn

@dinbror
Copy link
Owner

dinbror commented Jul 23, 2014

Hey SirMuppit.

Sorry for the really late reply. The check is there to ensure that we're not loading images that are hidden. When the offset values are 0 they're either hidden (display:none) or collapsed.

Do you have a live example I can see?

@shaughnlgh
Copy link
Author

Hey

Ye, so i have patched it with my suggested fix and it seems to work well now. You can see a live example here: http://s.boardmans.fontera.com/shop-by-room/kitchen/category/storage/show/all.html

I have implemented your script into a working Magento Module that could be reused on other Magento sites.

Regards
Shaughn

On 23 Jul 2014, at 12:50 PM, dinbror notifications@github.com wrote:

Hey SirMuppit.

Sorry for the really late reply. The check is there to ensure that we're not loading images that are hidden. When the offset values are 0 they're either hidden (display:none) or collapsed.

Do you have a live example I can see?


Reply to this email directly or view it on GitHub.

@dinbror
Copy link
Owner

dinbror commented Aug 5, 2014

Hey,

because you removed the check all your images are getting both the error and success class added: "b-error b-loaded".

How do you load the images with ajax?

@shaughnlgh
Copy link
Author

Hey, I’m not sure to be exact, i will need to setup a vanilla Magento store and check each instance. For now, close the bug and ill give more feedback and details on it as soon as i have a chance, since i can’t remember any of my finding’s lol.

I did notice the duplicate classes being added, but i will need to do a diff from you current version with the version i have now and see whats different.

Thanks for the reply, though. Much appreciated.

Regards
Shaughn

On 05 Aug 2014, at 2:41 PM, dinbror notifications@github.com wrote:

Hey,

because you removed the check all your images are getting both the error and success class added: "b-error b-loaded".

How do you load the images with ajax?


Reply to this email directly or view it on GitHub.

@dinbror dinbror closed this as completed Sep 3, 2014
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