LazyLoad

Lazy load iframes and images with attribute loading="lazy"

Source:
Properties:
Name Type Description
targetedHtmlTags array

list of html tags to enable lazy load for

selector string

targets elements on to set up lazy loading

Methods

(inner) getWatcherName(nodeName)

Source:

Get in view watcher name for given element type

Parameters:
Name Type Description
nodeName string

element node name

(inner) hasNativeSupport(nodeName)

Source:

Detect if lazy load is natively supported for specific element

Parameters:
Name Type Description
nodeName string

element node name

(inner) init()

Source:

Initialize InView watcher for handling lazy load image / iframes

(inner) load($target, key, value)

Source:

Loads content referenced by src url into designated element

Parameters:
Name Type Description
$target element

target element

key string

attribute name (e.g. src, srcset, sizes)

value string

attribute value (e.g. source URL, srcset list, etc.)

(inner) observeLiveBlog()

Source:

Creates MutationObserver for live blog, as the entries are loaded after the page renders This ensures that images and iframes get lazyloaded properly in liveblog

(inner) startWatching($target)

Source:

Listen to InView event fired by $target element,

Parameters:
Name Type Description
$target element