1
我一直试图通过jQuery为图像队列设置动画。由于某些原因,它忽略了我的jquery函数。图像将通过JSON数据动态加载到文档中。到目前为止,我能够加载图像并将每个div推送为下一个图像加载,这并不平滑。 Container div是调用#stream。每张图片都在div class call状态下。通过jQuery旋转动态图像
我试图将每个图像移动到左边后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");
}
任何帮助,非常感谢!
你的意思是这样的$(窗口).load(函数()?我试过了,但是,它是忽略了我的整个jQuery的功能。谢谢 – Tierendu
号尝试添加animateTheBox(); setTimeout(step,1000)之后; – Wolf
好吧,你给了我一个好主意,我试着在setTimeout之后立即调用call,然后我在setfTimeout之前尝试了,仍然忽略它。因为我只是需要在setTimeout内调用 – Tierendu