网站侧边栏添加公众号翻滚模块
前言
有些网站都有很好看的翻滚公众号图片,刚好看到六月是只猫有相关的教程,就抄一下,以下是教程
教程
首先在侧边栏自定义html添加如下代码
<div class="textwidget custom-html-widget"><div class="qqg-card-widget" id="qqg-card-wechat" onclick="window.open('https://www.xrbk.cn');">
<div id="qqg-flip-wrapper">
<div id="qqg-flip-content">
<div class="qqg-face"></div>
<div class="qqg-back qqg-face"></div>
</div></div></div></div>
CoreNext主题添加如下CSS代码到子主题中
/* wxgzh-card-shadow */
.wx-card-widget {
box-shadow: 0 8px 16px -4px #2c2d300c;
background: #fff;
border: 1px solid #e3e8f7;
transition: 0.3s;
border-radius: 12px;
transition: 0.3s;
position: relative;
overflow: hidden;
margin-top: 1rem;
padding: 1rem 1.2rem;
}
/* wxgzh-fanzhuan */
#wx-flip-wrapper {
position: relative;
width: 235px;
height: 110px;
z-index: 1;
}
#wx-flip-content {
width: 100%;
height: 100%;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
transition: cubic-bezier(0, 0, 0, 1.29) 0.3s;
}
#wx-flip-wrapper:hover #wx-flip-content {
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.wx-face {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
background: url(/wx_face.png) center center no-repeat;
background-size: 100%;
}
.wx-back.wx-face {
display: block;
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
box-sizing: border-box;
background: url(wx_code.png) center center no-repeat;
background-size: 100%;
}
/* wxgzh-background */
.wx-card-widget#wx-card-wechat::before {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: url(gzh_cover.png) center center no-repeat;
content: '';
}
.wx-card-widget#wx-card-wechat {
background: #57bd6a;
display: flex;
justify-content: center;
align-content: center;
padding: 0;
cursor: pointer;
border: none;
height: 110px;
}
.wx-card-widget#wx-card-wechat img {
max-height: 110px;
object-fit: cover;
}
/* QQG-card-shadow */
.qqg-card-widget {
box-shadow: 0 8px 16px -4px #2c2d300c;
background: #fff;
border: 1px solid #e3e8f7;
transition: 0.3s;
border-radius: 12px;
transition: 0.3s;
position: relative;
overflow: hidden;
margin-top: 1rem;
padding: 1rem 1.2rem;
}
/* QQG-fanzhuan */
#qqg-flip-wrapper {
position: relative;
width: 235px;
height: 110px;
z-index: 1;
}
#qqg-flip-content {
width: 100%;
height: 100%;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
transition: cubic-bezier(0, 0, 0, 1.29) 0.3s;
}
#qqg-flip-wrapper:hover #qqg-flip-content {
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.qqg-face {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
background: url(/qqg_face.png) center center no-repeat;
background-size: 100%;
}
.qqg-back.qqg-face {
display: block;
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
box-sizing: border-box;
background: url(/qqg_code.png) center center no-repeat;
background-size: 100%;
}
/* QQG-background */
.qqg-card-widget#qqg-card-wechat::before {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: url(/qq_cover.png) center center no-repeat;
content: '';
}
.qqg-card-widget#qqg-card-wechat {
background: #00aef8;
display: flex;
justify-content: center;
align-content: center;
padding: 0;
cursor: pointer;
border: none;
height: 110px;
}
.qqg-card-widget#qqg-card-wechat img {
max-height: 110px;
object-fit: cover;
}
下载附件图片素材上传到服务器,并修改css里面的url就行了,F5刷新就可以看到效果了。
来源:蓝奏云
THE END