我的代碼返回沒有錯誤,但只留下沒有背景圖片的疊加效應:選擇隨機背景與jQuery
$(function() {
var totalCount = 8;
var bg = Math.ceil(Math.random() * totalCount);
$("html").css({
"background": "linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, .8) 100%), url(../img/bg0"+bg.toString()+".png) no-repeat center center fixed"
});
});
我看你只使用backgr在CSS方法中的ound風格...爲什麼你需要paranthesis {..} ...?你可以嘗試沒有括號..我認爲該方法的值屬性不允許逗號.. – Lucky 2015-04-04 12:58:52