[英]Run instagram code after specific interval of time
I want to display the pictures from my Instagram to website. 我想将我的Instagram图片显示到网站上。 I am successful with the image display part, but when new Images are uploaded with the Tag i have mentioned then I want to display it at without refreshing the browser. 我在图像显示部分上取得了成功,但是当使用我提到的标签上传新图像时,我希望在不刷新浏览器的情况下显示它。 I want to just call the code again and again after 1 sec. 我只想在1秒后一次又一次调用代码。
var feed = new Instafeed({
clientId: 'fd49a37da9f04a47b046395a5d2a8fb9',
limit: 17 ,
get:'tagged',
tagName:'kdy14',
after: function () {
var images = $("#instafeed").find('a');
$.each(images, function(index, image) {
var delay = (index * 75) + 'ms';
$(image).css('-webkit-animation-delay', delay);
$(image).css('-moz-animation-delay', delay);
$(image).css('-ms-animation-delay', delay);
$(image).css('-o-animation-delay', delay);
$(image).css('animation-delay', delay);
$(image).addClass('animated flipInX');
});
},
template: '<a href="{{link}}" target="_blank"><img src="{{image}}" /></a>'
});
feed.run();
I want to make this JS run after every 1 sec. 我想让此JS每1秒运行一次。 How can I so this. 我怎么能这样
use : 采用 :
setInterval(function(){feed.run();}, 1000);//1000 is 1 s
PS : if you want to stop it in some place do this : PS:如果您想在某个地方停止它,请执行以下操作:
//first put the interval ID in an a var
var intervalID = setInterval(function(){feed.run();}, 1000);
//then when you want to stop it just do
clearInterval(intervalID);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.