Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

73 lines (59 sloc) 1.773 kB
<!DOCTYPE html>
<title>PreloadJS: Plugin Sample</title>
<link href="../_assets/css/shared.css" rel="stylesheet" type="text/css"/>
<link href="../_assets/css/examples.css" rel="stylesheet" type="text/css"/>
<script src="../_assets/js/examples.js"></script>
.image {
max-width: 320px;
max-height: 240px;
border: 1px solid #666;
margin: 5px;
<body onload="init()">
<header class="PreloadJS">
<h1>Example: Plugin</h1>
<p>In this example, a PreloadJS plugin is defined, which parses a load item
into an HTML image ID that is
already present in the HTML DOM. PreloadJS will then use the image to do
the loading, and the image
will be displayed in its defined position when it is loaded.</p>
<img class="image" id="texas"/>
<img class="image" id="bluebird"/>
<img class="image" id="nepal"/>
<script type="text/javascript" src="../lib/preloadjs-NEXT.combined.js"></script>
<!-- We also provide hosted minified versions of all CreateJS libraries. -->
<script id="editable">
var preload;
function init() {
// Create a new queue.
preload = new createjs.LoadQueue(false, "../_assets/art/");
// Use this instead to favor xhr loading
//preload = new createjs.LoadQueue(true, "assets/");
var plugin = {
getPreloadHandlers: function () {
return {
types: ["image"],
callback: function (item) {
var id = item.src.toLowerCase().split("/").pop().split(".")[0];
item.tag = document.getElementById(id);
"Autumn.png" //NOTE: Will not display
Jump to Line
Something went wrong with that request. Please try again.