Lazy Loading Image through attribute ( #shorts )

1 year ago
5

Hi Friends,

Lazy loading is a technique we can use in our web development to defer the loading of non-critical resources like images, scripts, or stylesheets until they are actually needed.

we can use the loading attribute on the img element and loading attribute can take three values:

auto: The browser decides when to load the image (this is browsers default behavior).
lazy: The browser can defer loading the image until it's within the user's viewport.
eager: The browser should load the image immediately.

example(replace example with actual image tags):
// Normal Image Loading
[img src="normal-image.jpg" alt="Normal Image"]

// Lazy Loading Image
[img src="placeholder-image.jpg"
data-src="lazy-image.jpg" alt="Lazy Loaded Image"
loading="lazy"]

#javascript #image #imagemetatags #metatags #lazy #loading #lazyloading #random #unique #html #object #array #string #nodejs #javascriptinterview #method #js #jquery #function #shorts #viral #popular #latest #new #coders #development #code #dev #interview #php #trend #trending #answer #laravel #youtube #instagram #socialmedia #education #edit #how #india #knowledge #quiz #reels #short #subscribe #share #update #video #web #webdeveloper #website #webdesign #ytshorts #youtuber #princecheema_official @princecheema_official

Loading comments...