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