在线读者墙html代码,纯代码为网站添加弹窗广告

额,想了半天不知道如何开篇~~~,还是直接上代码吧。

Pop-up-advertising-660x330.png

JavaScript 代码

var popup = document.getElementById('qgg_popup');

var popup_box = document.querySelector('.qgg_popup_box');

var popup_close = document.querySelector('.qgg_popup_close');

// 窗口加载时弹出

window.onload = function() {

popup.style.display = "block";

}

// 点击窗体其他位置时关闭

window.onclick = function(event) {

if (event.target == popup) {

popup.style.display = "none";

}

}

popup_box.onclick = function() {

popup.style.display = "none";

}

// 点击关闭按钮时关闭

popup_close.onclick = function() {

popup.style.display = "none";

}

WordPress建站的小伙伴们将JS代码丢到主题的主JS文件中去即可。DUX主题用户直接丢到主题 js 文件夹下的 main.js 文件中即可。

CSS样式代码

html, body{ margin:0; height:100%; }

#qgg_popup{

position: fixed;

top: 0; left: 0;

display: none;

width: 100%;

height: 100%;

margin: auto;

background: rgba(36, 36, 36, 0.8);

}

.qgg_popup_box {

z-index: 10;

position: absolute;

top: 0; left: 0; bottom: 0; right: 0;

width: 280px;

height: 396px;

margin: auto;

text-align: center;

}

.qgg_popup_close{

position: relative;

width: 36px;

height: 36px;

background: #fff;

color: #999;

float: right;

font-size: 24px;

text-align: center;

border-radius: 50%;

line-height: 36px;

font-weight: bold;

}

.qgg_popup_close:hover,

.qgg_popup_close:focus {

color: red;

cursor: pointer;

}

.qgg_popup_img{

position:relative;

top: 36px;

left: 0px;

width:240px;

height:360px;

border-radius: 15px;

}

@media (max-width: 640px){

.qgg_popup_close{ display: none; }

}

使用 WordPress 搭建网站的小伙伴将代码丢到主题的 style.css 文件中即可。DUX 主题有点儿特殊,丢到 main.css 文件中即可。

前端HTML显示代码

×

1.png

这段代码是前端显示的 HTML ,将其丢到你想要其显示的页面中即可,比如 index.php 、single.php 文件中即可。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值