我的网页上有一个fancybox 2,它显示了从网络摄像头自动生成的全尺寸图像。
我使用以下内容刷新网页上的图像:
//reload the images so they are always current
$(document).ready(function () {
setInterval('reloadBackscatterImage()', 60000); // 60 seconds
});
function reloadBackscatterImage() {
var src = $('#backscatter-img').attr('src');
// check for existing ? and remove if found
var queryPos = src.indexOf('?');
if (queryPos != -1) {
src = src.substring(0, queryPos);
}
//generate a timestamp so we always get the latest image (break browser cache)
var timestamp = new Date().getTime();
$('#backscatter-img').attr('src', src + "?time=" + timestamp);
$('#backscatter-link').attr('href', src + "?time=" + timestamp);
return false;
}
而fancybox目前由以下发起:
$(document).ready(function () {
$(".fancybox").fancybox();
});
$("#backscatter-link").fancybox({
openEffect: 'elastic',
closeEffect: 'elastic',
helpers: {
title: {
type: 'inside'
}
}
});
我需要fancybox内的图像同时刷新。我怎样才能做到这一点?