我想显示和图像 2 秒钟,然后隐藏它以显示图表。我的部分是图表在 2 秒后出现,但我不知道如何放置图像。
$("li").click(function(){
//Toggle List
$(this).toggleClass("active");
$(this).next("div").stop('true','true').slideToggle();
//SHOW image for 2 seconds and then HIDE IT
var did = $(this).attr('id');
var graphic;
if($(this).next("div").html() == '')
{
graphic = '';
$.ajax({
url: 'pulse.php?did='+did, success: function(data)
{
graphic = data;
}
});
}
//Here I show the chart after 2 seconds pulling the data from pulse.php...
delay(function(){
$("#"+did).next("div").html(graphic);
}, 2000 );
});
//Delay function
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();