javascript sequence playback picture frame

javascript playback picture sequence of frames
1 to preload
<pre>
var load_img = [];
for (K = 0; K & lt; = 16; K ++) {
load_img.push ( '/cjsxy/images/chuanyue/'+k+'.jpg ');
}

// Load resource image
jQuery.imgpreload (load_img, {
All: function () {

}
});
</pre>

Then html]


<pre>
<Script of the type = "text / JavaScript" src = "/ js / jquery.imgpreload.min.js"> </ Script>
<img class = "chuansuo" />
</ pre>
last play timer js

<pre>
$('.chuansuo').css('display', 'block');
i++;
if (i >= 16) {
$('.chuansuo').css('display', 'none');
i=0;
return false;
}
$('.chuansuo').attr('src', "/cjsxy/images/chuanyue/" + i + ".jpg");
ss = setTimeout(chuanyue, 200);
</pre>


Attention to the problem as far as possible it's smaller so the picture compression will be faster rendering speed

Guess you like

Origin www.cnblogs.com/newmiracle/p/11876739.html