我一直在尝试通过jQuery动画队列的图像。由于某种原因,它忽略了我的jquery函数。图像将通过JSON数据动态加载到文档中。到目前为止,我能够加载图像并将每个div作为下一个图像加载,这不是很顺利。容器div调用#stream。每个图像都在div类调用状态下。
我试着在加载后将每个图像向左移动270px(循环)。
模板的图片
queue.next(function(status, step) {
var div = document.createElement('div');
// create DOM element
var div = document.createElement('div');
div.className = 'status';
var photo = status.images.standard_resolution.url;
div.innerHTML = '<img src="'+photo+'"/>';
// add div to the top of the stream element (each new status is newer)
document.getElementById('stream').insertBefore(div, document.getElementById('stream').firstChild);
setTimeout(step, 1000);
});
jQuery我正在尝试使用
$(window).ready(function(){
animateTheBox();
});
function animateTheBox() {
$(".status").animate({"left": "+=270px"},"slow");
}
非常感谢任何帮助!
在这里你调用了document ready事件的animate函数
$(window).ready(function(){
animateTheBox();
});
加载图像后调用animateTheBox();
函数
ie在setTimeout(step, 1000);
调用中提到的step
函数