Magic Icon Deferred Load: Magic JavaScript

Quick Jump ↵

Loading an element's src attribute only after the page loads.

Usage

Add src="about:blank" data-mjf="deferred_load" data-mjf_deferred_load_src="/PATH/TO/ORIGINAL.SRC" id="ELEMENT_ID" to your <img> or <iframe> tags.

Add <script type="text/javascript">$m.wand.deferred_load = true;</script> inside your <body> tag.

Examples

Image

<img src="about:blank" alt="" data-mjf="deferred_load" data-mjf_deferred_load_src="../../tricks/darkroom/darkroom_example.jpg" id="deferred_load_img">

Iframe

<iframe src="about:blank" width="530" height="298" frameborder="0" data-mjf="deferred_load" data-mjf_deferred_load_src="http://www.youtube.com/embed/hSlgoyro520" id="deferred_load_iframe"></iframe>

Notes

Deferred loading is all fine and good until you content is loaded outside your website. When might this happen? Be sure to check your RSS feed for quality assurance.

More tag support (<input>, <audio>, <video>) will possibly be added in the future.

« Back to the main documentation