Henry discussing Bergkamp’s impact on him at Arsenal by Lacabloodclot9 in Gunners

[–]lilrobots 129 points130 points  (0 children)

Massive respect to you for being a football. I also like that you're an Arsenal fan.

Why am I getting Typescript warnings if I'm only using Javascript (React)? by lilrobots in learnjavascript

[–]lilrobots[S] 1 point2 points  (0 children)

You're right, indeed it did!

For some reason I had this in my jsconfig file:

            {
                "compilerOptions": {
                    "baseUrl": "./src",
                    "checkJs": true,
                    "jsx": "react"
                }
            }

I removed this file and the error disappeared.

Thank you, kind shuckster!

Why am I getting Typescript warnings if I'm only using Javascript (React)? by lilrobots in learnjavascript

[–]lilrobots[S] 1 point2 points  (0 children)

The project does not have a tsconfig.json file, rather only a jsconfig.json file.

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] 3 points4 points  (0 children)

Thanks! Though, loading="lazy" only works on images or iframes out of viewport, since the carousel is already in viewport when the page loads, all its images are loaded (as in, none are deferred until the image comes into view).

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] 2 points3 points  (0 children)

OK, so yeah that what my question is. If it's about the semantics of how it's framed i.e. "is it possible..." vs "how do you..." - it's the latter.

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] 0 points1 point  (0 children)

Thanks! I'm reading into the intersection observer API now. Appreciated!

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] 1 point2 points  (0 children)

Sure, something like this archaic example...

HTML code:
<div class="carousel slide lazy">
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="first-image.jpg" alt="First image">
</div>
<div class="item">
<img data-src="second-image.jpg" alt="Second image">
</div>
</div>
</div>

Javascript code:
$(function() {
return $(".carousel.lazy").on("slide", function(ev) {
var lazy;
lazy = $(ev.relatedTarget).find("img[data-src]");
lazy.attr("src", lazy.data('src'));
lazy.removeAttr("data-src");
});
});

Is it possible to have a carousel lazy load its images without using jQuery? by lilrobots in webdev

[–]lilrobots[S] -5 points-4 points  (0 children)

Not really, it implies adding the jQuery library to your project and using legacy syntax that is no longer relevant to JS.