javascript - Holder.js -- Get back DOM element? -
holder.js
i want dynamically add together placeholder image page.
inserting doesn't work:
$('<li>',{class:'file-item'}) .append($('<img>',{'data-src':'holder.js/150x150'})) .append($('<span>',{class:'file-name'}).text(file.name)) .appendto('#file-list');
because holder script has ran , isn't searching new elements.
we can, however, run 1 time again manually:
holder.run()
but scan elements added.
so...is there way can holder.js create , give me dom element can add together manually without re-running whole thing?
pass node
images
property holder.run
, you'll able run holder on individual image. holder doesn't create dom element, changes src
value.
code:
var image = $("<img>").attr({ "data-src": "holder.js/300x200" }) holder.run({ images: image[0] }); image.appendto("body");
live illustration here: http://jsfiddle.net/imsky/p3dma/
javascript holder.js
No comments:
Post a Comment