Рандомный кликабельный фон WordPress

Д1
На сайте с 27.06.2019
Offline
0
289

Добрый день!

Нужна помощь в правке кода. Все работает только кликабельным становится полностью весь сайт а не только фон.

Код во вложении, Спасибо

Готов оплатить Ваш труд и время.

<script>

var banners = [ '<a href="https:"rel="nofollow" target="_blank"><div class="empl"></div></a><div class="passiverevshare"></div><style>.tabs .widget ul li a:nth-child(n+2) {left:1px!important}</style>',

'<a href="https:"rel="nofollow" target="_blank"><div class="empl"></div></a><div class="ucoint"></div><style>.tabs .widget ul li a:nth-child(n+2) {left:1px!important}</style>',

],

rand = Math.trunc(Math.random() * (banners.length - 0) + 0);

// insert = document.querySelector('.code_block');

// insert.innerHTML = banners[rand];

// console.log(banners[rand]);

// insert.appendChild(insert);

document.write(banners[rand]);

// $html(banners[rand]);

// $('body').before(banners[rand]);

</script>

<style>

.passiverevshare {display:block; z-index:1; position:absolute; width:100%; height:100%;

background: #F7F1FF url(https:1300x900-min.jpg) top center;

background-repeat: no-repeat!important;

}

@media only screen and (min-width: 1280px) {

.passiverevshare {

background: #F7F1FF url(https:1600x900-min.jpg) top center!important;

background-repeat: no-repeat!important;

}

}

@media only screen and (min-width: 1600px) {

.passiverevshare {

background: #F7F1FF url(https:1900x1000-min.jpg) top center!important;

background-repeat: no-repeat!important;

}

}

@media only screen and (min-width: 1900px) {

.passiverevshare {

background: #F7F1FF url(https:_3000x1000-min.jpg) top center!important;

background-repeat: no-repeat!important;

}

}

</style>

</style>

.ucoint {display:block; z-index:1; position:absolute; width:100%; height:100%;

background: #1F282F url(https:1300x900-min.jpg) top center;

background-repeat: no-repeat!important;

}

@media only screen and (min-width: 1280px) {

.empl {

background: #1F282F url(https:_1600x900-min.jpg) top center!important;

background-repeat: no-repeat!important;

}

}

@media only screen and (min-width: 1600px) {

.empl {

background: #1F282F url(https:1900x1000-min.jpg) top center!important;

background-repeat: no-repeat!important;

}

}

@media only screen and (min-width: 1900px) {

.empl {

background: #1F282F url(https:/t_3000x1000-min.jpg) top center!important;

background-repeat: no-repeat!important;

}

}

</style>

S
На сайте с 30.09.2016
Offline
469
#1

1. Для вставки кода в редакторе сообщений существует кнопочка #.

2. В приведённом коде столько исправлений, что непонятно, чего добивался его создатель.

3. На странице с этим кодом вообще ничего не кликабельно, не то что какой-то там непонятный фон или некий гипотетический сайт. Причина - нулевая высота блока под ссылкой.

Отпилю лишнее, прикручу нужное, выправлю кривое. Вытравлю вредителей.
Д1
На сайте с 27.06.2019
Offline
0
#2

Данный код был взят с сайта profvest.com и он там отрабатывает на 100% у меня же на сайте faktinvest.ru данный код отрабатывает почти полностью ( фон весь кликабельный а не только в шапке и по бокам )

Если вы скажете как сделать рандомный кликабельный фон ( у каждого фона индивидуальная гиперссылка ) то буду признателен.

<script>

var banners = [ '<a href="https://profvest.page.link/passiverevshare-r-b" rel="nofollow" target="_blank"><div class="empl"></div></a><div class="passiverevshare"></div><style>.tabs .widget ul li a:nth-child(n+2) {left:1px!important}</style>',

'<a href="https://profvest.page.link/ucoint-r-b" rel="nofollow" target="_blank"><div class="empl"></div></a><div class="ucoint"></div><style>.tabs .widget ul li a:nth-child(n+2) {left:1px!important}</style>',

'<a href="https://profvest.page.link/ruizcoin-r-b" rel="nofollow" target="_blank"><div class="empl"></div></a><div class="ruizcoin"></div><style>.tabs .widget ul li a:nth-child(n+2) {left:1px!important}</style>',

'<a href="https://profvest.page.link/yesss-r-b" rel="nofollow" target="_blank"><div class="empl"></div></a><div class="yesss"></div><style>.tabs .widget ul li a:nth-child(n+2) {left:1px!important}</style>',

'<a href="https://profvest.page.link/fxtradingcorp-r-b" rel="nofollow" target="_blank"><div class="empl"></div></a><div class="fxtradingcorp"></div><style>.tabs .widget ul li a:nth-child(n+2) {left:1px!important}</style>',

'<a href="https://profvest.page.link/el-terro-r-b" rel="nofollow" target="_blank"><div class="empl"></div></a><div class="el-terro"></div><style>.tabs .widget ul li a:nth-child(n+2) {left:1px!important}</style>',

],

rand = Math.trunc(Math.random() * (banners.length - 0) + 0);
// insert = document.querySelector('.code_block');
// insert.innerHTML = banners[rand];
// console.log(banners[rand]);
// insert.appendChild(insert);

document.write(banners[rand]);
// $html(banners[rand]);

// $('body').before(banners[rand]);
</script>




.passiverevshare {display:block; z-index:0; position:absolute; width:100%; height:100%;
background: #F7F1FF url(https://3.bp.blogspot.com/-phAgD5-xYXE/XQh9Yg66NyI/AAAAAAAA04k/MLOQJpSPayM9z1tB2FGV786sUjh6j8QGwCLcBGAs/s1600/passiverevshare_1300x900-min.jpg) top center;
background-repeat: no-repeat!important;
}

@media only screen and (min-width: 1280px) {
.passiverevshare {
background: #F7F1FF url(https://4.bp.blogspot.com/-8ieri11-5zA/XQh9gARdRhI/AAAAAAAA04s/I2H1FBuwR7Eo1mTvY4OB-5htEPqILxQggCLcBGAs/s0/passiverevshare_1600x900-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1600px) {
.passiverevshare {
background: #F7F1FF url(https://1.bp.blogspot.com/-uBadoFbzeKA/XQh9ni3tNeI/AAAAAAAA04w/YgEQH-hm0y8h_bqIm4FQ2ATOhtYvNbplQCLcBGAs/s0/passiverevshare_1900x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1900px) {
.passiverevshare {
background: #F7F1FF url(https://1.bp.blogspot.com/-WBI5dLD0V5M/XQh9xXmH_oI/AAAAAAAA048/wiCU4Dxi2oIG5z8NDnMFKlNR829CQkS8QCLcBGAs/s0/passiverevshare_3000x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}

.ucoint {display:block; z-index:0; position:absolute; width:100%; height:100%;
background: #1F282F url(https://1.bp.blogspot.com/-Hs51xj66Rmo/XQh-bgegO2I/AAAAAAAA05M/fK2lINJwGzMfTKYf9fj9YluNttKnn73oQCLcBGAs/s1600/ucoint_1300x900-min.jpg) top center;
background-repeat: no-repeat!important;
}

@media only screen and (min-width: 1280px) {
.ucoint {
background: #1F282F url(https://3.bp.blogspot.com/-Xxqj8PyIg-A/XQh-iSMkNwI/AAAAAAAA05Q/YSVu9iVyv64kSyWg-h0TQo9mZQGe1TTrACLcBGAs/s1600/ucoint_1600x900-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1600px) {
.ucoint {
background: #1F282F url(https://3.bp.blogspot.com/-I1piP5eQMrQ/XQh-pUbgXhI/AAAAAAAA05Y/JvMovvroO9APtATQ6mq8fiDRYXlxCGCAgCLcBGAs/s0/ucoint_1900x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1900px) {
.ucoint {
background: #1F282F url(https://2.bp.blogspot.com/-PykYJOSrkOk/XQh-vmB74WI/AAAAAAAA05c/r2sXePRX4ZEPKs8FssMrQVUIwe57a7SAACLcBGAs/s0/ucoint_3000x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}

.ruizcoin {display:block; z-index:0; position:absolute; width:100%; height:100%;
background: #FFFFFF url(https://3.bp.blogspot.com/-qXzvXsAAplw/XQPNpTSgr9I/AAAAAAAA0pk/eER85JNXSZEIc4tsrc-eGUegJXXAoJimwCLcBGAs/s1600/ruizcoin_1300x900-min.jpg) top center;
background-repeat: no-repeat!important;
}

@media only screen and (min-width: 1280px) {
.ruizcoin {
background: #FFFFFF url(https://2.bp.blogspot.com/-XGCao49lgp4/XQPNt7Iz-lI/AAAAAAAA0po/4fZLFLCoXQsY9qfAZvpoPLuH6k7GsD2fgCLcBGAs/s1600/ruizcoin_1600x900-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1600px) {
.ruizcoin {
background: #FFFFFF url(https://2.bp.blogspot.com/-E2mwPf0N1rg/XQPN0kuy5uI/AAAAAAAA0ps/lbLBjDPr-uUDUAQTi26ZyUH05Yx5tBiEACLcBGAs/s0/ruizcoin_1900x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1900px) {
.ruizcoin {
background: #FFFFFF url(https://4.bp.blogspot.com/-tNzJ4cP85Pw/XQPN9N2ZpXI/AAAAAAAA0p4/4GX0F_tKuO8QNjWsbKE2ncrUiepmZWzhgCLcBGAs/s0/ruizcoin_3000x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}

.yesss {display:block; z-index:0; position:absolute; width:100%; height:100%;
background: #333846 url(https://1.bp.blogspot.com/-dcDzF_tvl_s/XPoDWImkZeI/AAAAAAAA0QE/8B5LDm7QpMENVzbxnuoZXKlIzQiG0P6lACLcBGAs/s1600/yesss_1300x900-min.jpg) top center;
background-repeat: no-repeat!important;
}

@media only screen and (min-width: 1280px) {
.yesss {
background: #333846 url(https://1.bp.blogspot.com/-CD9aBGkzzrE/XPoDdumh0SI/AAAAAAAA0QI/bYvuw8aPIA0ceLCqsIC4-9HdQkPMoGqqACLcBGAs/s1600/yesss_1600x900-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1600px) {
.yesss {
background: #333846 url(https://3.bp.blogspot.com/-2sgOYIKw8X4/XPoDktHPX8I/AAAAAAAA0QQ/xzsFwLM70skgjaYE80OXXJv24VPUfW78ACLcBGAs/s0/yesss_1900x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1900px) {
.yesss {
background: #333846 url(https://3.bp.blogspot.com/-umI2vs3v0ks/XPoDt5ze5-I/AAAAAAAA0QU/GVvOG0AdpZ89Ax8YwfiKzCwZOiEN5rwOACLcBGAs/s0/yesss_3000x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}

.fxtradingcorp {display:block; z-index:0; position:absolute; width:100%; height:100%;
background: #45309D url(https://2.bp.blogspot.com/-ebRHUryfdgs/XOTl7-YQXuI/AAAAAAAAzLs/YfHQeOSfG7IhCNEv15ohFmVrTQxDHWe1gCLcBGAs/s1600/fxtradingcorp_1300x900-min.jpg) top center;
background-repeat: no-repeat!important;
}

@media only screen and (min-width: 1280px) {
.fxtradingcorp {
background: #45309D url(https://4.bp.blogspot.com/-72c6c1ItDjg/XOTmHcBTv-I/AAAAAAAAzLw/e8mSE_U2NboigneDDcqvyQ_K0iYucEz5ACLcBGAs/s1600/fxtradingcorp_1600x900-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1600px) {
.fxtradingcorp {
background: #45309D url(https://1.bp.blogspot.com/-t8QSa4XHiZQ/XOTmOrZ-37I/AAAAAAAAzL4/DFta9LaC0_EgcumZ8ncBrWgfLnnqIBivQCLcBGAs/s0/fxtradingcorp_1900x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1900px) {
.fxtradingcorp {
background: #45309D url(https://3.bp.blogspot.com/-cFOlupHkGpo/XOTmXoiwGuI/AAAAAAAAzMA/3zNz0EDxUN8rL9go1n9tOCMhx6jCdL2KACLcBGAs/s0/fxtradingcorp_3000x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}

.el-terro {display:block; z-index:0; position:absolute; width:100%; height:100%;
background: #D9E486 url(https://2.bp.blogspot.com/-JjTvY6LUmU0/XOQ3n1dMDWI/AAAAAAAAzKI/6f3jxssG3zIPbz8Wu9J__qFwf-fyletSACLcBGAs/s1600/el-terro_1300x900-min.jpg) top center;
background-repeat: no-repeat!important;
}

@media only screen and (min-width: 1280px) {
.el-terro {
background: #D9E486 url(https://1.bp.blogspot.com/-OEI90BzepQc/XOQ3uq4vUoI/AAAAAAAAzKM/n5P2Ex-ZDSgdvJmrxQxnvs-CsZ9oRArOwCLcBGAs/s1600/el-terro_1600x900-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1600px) {
.el-terro {
background: #D9E486 url(https://1.bp.blogspot.com/-pUFopAP6T8A/XOQ30h2yhQI/AAAAAAAAzKU/B27iGs8Hb-EaI6fwKyFwv1dkgZVSjgtfgCLcBGAs/s0/el-terro_1900x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1900px) {
.el-terro {
background: #D9E486 url(https://4.bp.blogspot.com/-Ax3KZlBvQOs/XOQ35U5Kn7I/AAAAAAAAzKc/tIRVlzyaPvstfW1vy_buPNp0JSugACDdACLcBGAs/s0/el-terro_3000x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}

.first-trading {display:block; z-index:0; position:absolute; width:100%; height:100%;
background: #124D67 url(https://3.bp.blogspot.com/-SnYsb8HLyEQ/XJKRcjr5RuI/AAAAAAAAvgI/GT6yNLUQV3YoLbmQYKxokc9jW8SV5c7rQCLcBGAs/s1600/first-trading_1300x900-min.jpg) top center;
background-repeat: no-repeat!important;
}

@media only screen and (min-width: 1280px) {
.first-trading {
background: #124D67 url(https://1.bp.blogspot.com/-NRVY_dTSvSU/XJKRen5sRwI/AAAAAAAAvgM/RRLysrsWawg4xuQfr1EiPIy8_OA8nwcVACLcBGAs/s1600/first-trading_1600x900-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1600px) {
.first-trading {
background: #124D67 url(https://4.bp.blogspot.com/-0cKYZ5H2hdo/XJKRg5xhXjI/AAAAAAAAvgQ/oT1YPyLTMDI8GsVU8hy0Bto1ikvRazbTgCLcBGAs/s0/first-trading_1900x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
@media only screen and (min-width: 1900px) {
.first-trading {
background: #124D67 url(https://2.bp.blogspot.com/-yohKNuBYRDA/XJKRi2phf5I/AAAAAAAAvgU/Hc2cJEoemAYNfbgaysd4PjYwHqHWc8iYQCLcBGAs/s0/first-trading_3000x1000-min.jpg) top center!important;
background-repeat: no-repeat!important;
}
}
.empl {
display: block;
z-index: 1;
position: absolute;
width: 100%;
height: 470px;
}
S
На сайте с 30.09.2016
Offline
469
#3

На Вашем сайте вёрстка другая. Игра ведётся за счёт z-index, но на Вашем сайте блоки иначе перекрываются, чем на том сайте, откуда взят код. Поэтому надо стили переписывать по-другому.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий