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

Add lazyLoadSourceAttr and lazyLoadTargetAttr #916

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add lazyLoadSourceAttr and lazyLoadTargetAttr #916

wants to merge 4 commits into from

Conversation

hultberg
Copy link

Allow to change where lazyLoad gets image src (data attribute) with lazyLoadSourceAttr also allow where lazyLoad will put the image (default src on img-tag).

I have added an extra sourceAttr support for one of my projects where we use divs for images to have them floating inside fixed height. If lazyLoadTargetAttr is 'background-image' then lazyLoad will look for divs with matching sourceAttr and simply set background-image on them.

@hultberg
Copy link
Author

@CHEWX
Copy link

CHEWX commented Jul 24, 2015

Good feature, I guess it's not going to be merged in ?

@hultberg

@bennybee
Copy link

Would be a very useful feature, and would be good if it didn't rely on the container being a div (eg be able to add the data-lazy attribute to an LI tag)

@huan086
Copy link

huan086 commented Oct 6, 2015

Instead of $('div[' + _.options.lazyLoadSourceAttr + ']', imagesScope).each(function () {

I used this

            var lazyAttribute = '[' + _.options.lazyLoadSourceAttr + ']';
            $(lazyAttribute, imagesScope).addBack(lazyAttribute).each(function () {

so that I could use A instead of DIV with lazy loaded background. The addBack is due to A itself being the slick-slide, instead of the usual case of being the children of slick-slide.

@hultberg
Copy link
Author

hultberg commented Oct 9, 2015

Thats a good point @huan086 !

@stha
Copy link

stha commented Nov 3, 2015

Is this going to be merged within the next time?

@hultberg
Copy link
Author

hultberg commented Nov 5, 2015

@stha: I would need to fix the conflicts first, but I could update this PR and hope for it to be merged.

@ahmadalfy
Copy link
Collaborator

Please fix the conflicts if there is any ...

Pinging @kenwheeler

@masi
Copy link

masi commented Nov 12, 2015

#1661 is related. If I understand #1661 correctly the change would affect all images.

Anyway, what I would require is that I can choose on a per image basis if the src or the srcset ist to be lazy loaded.

@yivo
Copy link

yivo commented Dec 15, 2015

Are there any progress on it?

@gino8080
Copy link

gino8080 commented May 9, 2016

dead? :)

@vitekvil
Copy link

vitekvil commented Jul 6, 2016

when rows is more 2 after resize of window loaded images are lost and nothing is shown

@1ucay
Copy link

1ucay commented Sep 26, 2016

latest version #2538

@1ucay 1ucay mentioned this pull request Sep 26, 2016
@leofrozenyogurt
Copy link

revive?

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

Successfully merging this pull request may close these issues.