jsor/lity

Migrate to vanilla js

wpsumo opened this issue ยท 12 comments

Move from jQuery dependencies to vanilla js:
https://wpspeedmatters.com/jquery-performance/

@jsor Any plans to migrate to vanilla js? ๐Ÿ‘

@jsor +1 ๐Ÿ‘

naton commented

So, is anyone doing this? Should we just start? :)

(There is also the great https://youmightnotneedjquery.com/ btw)

@naton Don't think so go ahead and do it, I will be the first one to swap :)

naton commented

OK, here's a shot: https://github.com/naton/lity/tree/vanilla_js

As stated in the README, it's not without bugs so any help squashing them would be awesome. I think I solved all of the problems after all.

naton commented

@wpsumo Did you get a chance to try it out yet? I'm confident enough to merge it into my master now, and then do a PR here, if that's of interest.

naton commented

Anyway, I opened up a PR for this. Let me know if it should be based on another branch than master or if there's anything else I should do.

@wpsumo Did you get a chance to try it out yet? I'm confident enough to merge it into my master now, and then do a PR here, if that's of interest.

@naton Sorry missed your comment, no I just saw it haven't had a chance to test it out yet. Let me test it next week and get back to you. I will test it within wordpress with data-lity-target on the img tag. I will let you know how it goes within wordpress and defer and delay loading of javascript/s.

<img src="https://cdn.example.com/image.jpg" data-lity-target="https://cdn.example.com/image.jpg" alt="alt text" >

Just tested it with the code below, works perfectly, thanks a lot @naton !
<a href="https://youtube.com/watch?v=HFT7ATLQQx8" data-lity>Test Video</a>

@naton Since this project doesn't seem to be maintained anymore (last PR merged was Dec 22, 2020), can we all move to your fork?

@naton would make sense to do that based on @ojvribeiro comment above. Lets all move to your fork and continue using lity.

I've not tested it yet, sorry about that, it's about time to do it! I'll let you know :D

naton commented

Feel free to! I can't promise anything but since I use it myself I'll fix bugs as I find them.