0
的setTimeout符碼是什麼我想要做的,如果後一個隨機的文本和圖像已被choosen(的作品)顯示隱藏的div打破代碼?
我有一個名爲報價DIV其中,隨機的文字和圖片去,我想,要在淡出說喜歡3秒的時間....
,但它只是心不是工作我是個nooby所以任何幫助將是巨大的繼承人的代碼,我到目前爲止有:
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Random</title>
<script src="jquery-2.1.1.min.js"></script>
</head>
<body>
<div id="quote"></div>
<script>
(function() {
var quotes = [
{
text: "text1",
img: "http://i.stack.imgur.com/FqBE6.jpg?s=32&g=1"
},
{
text: "text2",
img: "https://www.gravatar.com/avatar/ca3e484c121268e4c8302616b2395eb9?s=32&d=identicon&r=PG",
},
{
text: "text3",
img: "https://www.gravatar.com/avatar/ca3e484c121268e4c8302616b2395eb9?s=32&d=identicon&r=PG",
}
];
var quote = quotes[Math.floor(Math.random() * quotes.length)];
document.getElementById("quote").innerHTML =
'<p>' + quote.text + '</p>' +
'<img src="' + quote.img + '">';
})();
$('#quote').hide();
setTimeout(function(){
$('#quote').show();
$('#quote').fadeIn(1000);
}, 3000);
</script>
</body>
</html>
我也想報價DIV被隱藏在1st hide(); 任何想法的?謝謝。
工作完全正常的嗎?當然,它永遠不會消失的東西,因爲它是從上面就行了'show'已經可以看到! – adeneo 2014-12-13 18:48:52