javascript - Is it sane to use the Jquery Asynchronous Image Loader (JAIL) for every image and have the data-src attribute be the trigger? -
i've been working on legacy web app code uses jail (https://github.com/sebarmeli/jail). safe/sane use jail on every "img" tag rather having additional class/id limit scope of jail specific images?
for instance, advisable (what our current code does):
$('img').jail(); and expect jail kick in on images have "data-src" attribute? (90% of our images not have data-src, , our expectation data-src images handled jail. seems work of time, there few errors may related after upgrading jail 1.0.0, , seems overhead little crazy -- jail has inspect every image?).
should instead using img.lazy approach docs , examples seem advocate (i seem because show this, don't recommend against other)?
<script> $(function() { $('img.lazy').jail(); }); </script> i'm not yet sure if errors i'm seeing after upgrading related jail or other stuff on our site (there lot going on, of dynamic, , i'm not javascript guru, it's non-trivial debug @ moment). (i'm seeing errors reported on earlier versions of jail, hence trying upgrade 0.9.5 1.0.0: https://github.com/sebarmeli/jail/issues/22 .)
also, i'm concerned if our issues not related our current jail setup (something else), may still slow/expensive because we're asking jail inspect every image?
any (reasonable ;)) advice appreciated.
if plugin acts on data-src attribute, target that.
$("img[data-src]").jail();
Comments
Post a Comment