How can I use CreateJS's PreloadJS to load images and retain attributes?

时间:2016-02-12 20:50:09

标签: javascript jquery html createjs preloadjs

I am trying to preload images with CreateJS/PreloadJS. These images will replace an image with attributes like id and class. When I use JQuery to replace the image, all of these attributes are lost.

What is the proper way to preload images and then later display the images on my page?

select person_id, event_desc, event_type
from (
  select person_id,
         event_desc,
         event_type, 
         row_number() over (partition by person_id order by idx desc) as rn
  from person_event_data
) t
where rn = 1;

1 个答案:

答案 0 :(得分:0)

在使用JQuery替换元素之前,将属性应用于新图像。

var newImage = queue.getResult(label);
newImage.setAttribute("class", "fit center");
newImage.setAttribute("id", "main");
$('#main').replaceWith(newImage);