這是我的隨機編碼div
background-image
。我只是想知道如何爲每個background
添加某些說明div
。隨機div內容+背景
<div class="slider"></div>
$(function() {
var url = "http://maispc.com/samuel/content/images/",
imgArray = [url+"avatar.png",
url+"provider/blogger.png",
url+"provider/LinkedIn-32x32.png",
url+"provider/myspace.png",
url+"provider/instagram.png",
url+"provider/Twitter-32x32.png",
url+"provider/stackoverflow.png",
url+"provider/Facebook-32x32.png"],
randomNumber = Math.floor((Math.random() * imgArray.length)),
baseUrl = "url('" + imgArray[randomNumber] + "')";
$(".slider", ".tab").css('background-image', baseUrl);
})();
是這樣
{ $(function() {
var url = "http://maispc.com/samuel/content/images/",
imgArray = [url+"avatar.png",
url+"provider/blogger.png", description div 1
url+"provider/LinkedIn-32x32.png",description div 2
url+"provider/myspace.png", and so ....
url+"provider/instagram.png",
url+"provider/Twitter-32x32.png",
url+"provider/stackoverflow.png",
url+"provider/Facebook-32x32.png"],
randomNumber = Math.floor((Math.random() * imgArray.length)),
baseUrl = "url('" + imgArray[randomNumber] + "')";
$(".slider").css('background-image', baseUrl);
})();
}
什麼是 「描述格」?請[編輯]你的問題來解釋所需的行爲是什麼。 – nnnnnn
你對每張幻燈片都有描述嗎? –
like div content –