【发布时间】:2013-10-23 12:31:08
【问题描述】:
我正在尝试设置主体的背景图像,但仅限于使用类 banner_url 的地方。 HTML如下:
<body id="app_body" class="banner_url desktopapp" data-backdrop-limit="1">
基本上,我想强制页面使用以下 CSS:
.banner_url {
background: url('http://www.pxleyes.com/images/contests/kiwis/fullsize/sourceimage.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
我正在尝试使用 Greasemonkey 来做这件事,如果它有什么不同的话。有谁知道我该怎么做?我从以下开始,但运气不佳:
function randomBG(){
document.getElementsByClassName("banner_url").style.backgroundImage="url('http://www.pxleyes.com/images/contests/kiwis/fullsize/sourceimage.jpg')no-repeat center center fixed;";
}
randomBG();
【问题讨论】:
标签: javascript css greasemonkey userscripts tampermonkey