开发者

Make the background through javascript

I want to put the background after you downlo开发者_开发百科ad the entire code and files in html. It can however be done. Make it so that the background is loaded after all the content.


Set it after the DOM loads:

$(function() {
    $("body").css("background-color", "red");
});

or after the whole page (e.g. images) has loaded:

$(window).load(function() {
    $("body").css("background-color", "red");
});  


If by background you mean a background image:

$(function(){
    $('body').css('background','url(\'url-to-background-image\')');
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜