php刷新一次换一次背景图,刷新主题页面更换背景图片

言七墨

教程言七墨:

将言七墨以下代码添加到 header.php 中的

< ?php { ? >

//

var bodyBgs = [];

bodyBgs[0] = "#page{background:url(https://cdn.qimok.cn/7a9633f2ce93034f29ce684984cca9ed%281%29.jpg);background-position:36% 33%;background-attachment: fixed;}@media screen and (max-width: 768px) {.style-vertical #top-part{background-position: 16% 28%;}}";

bodyBgs[1] = "#page{background:url(https://cdn.qimok.cn/8eb8a5c5750e75c8aa4be978f4ad0731%281%29.jpg);background-position: 33%;background-attachment: fixed;}@media screen and (max-width: 768px) {.style-vertical #top-part{background-position: 63%;}}";

bodyBgs[2] = "#page{background:url(https://cdn.qimok.cn/4099f865bb612479510a47751e987571%281%29.jpg);background-position: 99% 33%;background-attachment: fixed;}@media screen and (max-width: 768px) {.style-vertical #top-part{background-position: 85% 28%;}}";

bodyBgs[3] = "#page{background:url(https://cdn.qimok.cn/72b23b9dea0337e63aa61ff347ac89ce%281%29.jpg);background-size: 1280px;background-attachment: fixed;}@media screen and (max-width: 768px) {.style-vertical #top-part{background-size: 1280px;background-position: 45% 2%;}}";

bodyBgs[4] = "#page{background:url(https://cdn.qimok.cn/b9e4391de3aca57cecab3dd02fea59c6%281%29.jpg);background-position: 20% 0%;background-attachment: fixed;}@media screen and (max-width: 768px) {.style-vertical #top-part{background-position: 45% 2%;}}";

var randomBgIndex = Math.round(Math.random() * 4);

//输出随机的背景图[cunyanr.cn]

document.write('');

//]]>

< /script>

<?php }?>/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值