子比主题美化-侧边栏自定义悬浮按钮适配多种功能按钮

图片[1]-子比主题美化-侧边栏自定义悬浮按钮适配多种功能按钮-懒人Blog(资源素材网)

按钮介绍

  • 适配“会员”按钮,点击后自动跳转开通子比主题会员弹窗
  • 增加“昼夜”切换模式,点击后切换“日间”或“夜间”模式。
  • 适配“签到”按钮,点击后自动签到。
  • 替换抽奖按钮及图标,可自定义图标&链接。
  • 重构“返回顶部”的监听滚动及点击事件Javascript代码。

代码部署

可自建文件存放,CSS和JS代码可使用外链方式到HTML代码内。

子比主题亦可选择添加到如下位置:

zibll主题设置 >> 全局功能 >> 自定义代码 >> 自定义底部HTML代码

zibll主题设置 >> 全局功能 >> 自定义代码 >> 自定义CSS代码

/*
 * @Description     : 自定义悬浮按钮
 * @Url             : https://www.lanrenn.cn/
 * @Email           : 410753470@qq.com
 * @Date            : 2024-01-18 13:14:52
 */
.lanrenn-float {
  position: fixed;
    bottom: 20%;
    right: 1%;
    z-index: 999;
}
.lanrenn-float-box{
    box-shadow: 0 4px 23px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: #fff;
}
.lanrenn-float .lanrenn-float-item{
    color: rgba(23,23,24,0.8);
    text-align: center;
    cursor: pointer;
    width: 54px;
    padding-bottom: 10px;
    box-sizing: initial;
    align-items: center;
    display: block;
}
.lanrenn-float .lanrenn-float-item i{
  font-size: 22px!important;
    z-index: 2;
    position: relative;
    color: #171718;
}
.lanrenn-float .lanrenn-float-item a{
    color: rgba(23,23,24,0.8);
    font-size: 12px;
  text-decoration: none;
}
.lanrenn-float .lanrenn-float-item a:hover{
    color: var(--primary-color)!important;
}
.lanrenn-float .lanrenn-float-item img{
    width: 24px;
}
.lanrenn-float .lanrenn-float-item p.text{
    font-size: 12px;
    margin-top: 5px;
}
.lanrenn-float .lanrenn-float-item:hover p.text{
    color: var(--primary-color)!important;
}
.lanrenn-float .lanrenn-float-item.lanrenn-floats{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}
.lanrenn-float .activity{
    background: transparent;
    position: relative;
    height: 128px;
    padding-bottom: 0;
}
.lanrenn-float .activity a{
    display: block;
}
.lanrenn-float .activity .a1{
    width: 100%;
    height: 100%;
    border-radius: 7px 7px 0px 0px;
}
.lanrenn-float .activity .a2{
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 33px;
    height: 43px;
    animation: red-envelope-shake 0.8s linear infinite;
    transition: all .3s;
}
@keyframes red-envelope-shake {
    0% { transform: rotate(-7deg) }
    50%  { transform: rotate(7deg) }
    100% {transform: rotate(-7deg) }
}
@keyframes turnX{

    0%{transform:rotateX(0deg);}

    100%{transform:rotateX(360deg);}

}
.lanrenn-float .activity .popover {
    position: absolute;
    width: 251px;
    height: 128px;
    right: 0;
    left: -196px;
    bottom: 0;
    display: none;
}
.lanrenn-float .activity:hover .popover {
    display: block;
}

.lanrenn-float-box .lanrenn-float-vip{
    background: linear-gradient(10deg,#fedd92,#fef6e1);
    color: #803300;
    padding-top: 10px;
    margin-bottom: 10px;
}
.lanrenn-float-box .lanrenn-float-vip a{
    color: #803300!important;
}
.lanrenn-float-box .lanrenn-float-vip:hover p.text{
    color: #803300!important;
    font-weight: 600;
}

.lanrenn-float-service{
    position: relative;
}
.lanrenn-float-service:hover .lanrenn-float-service-box {
  display: block;
  transition: all .3s;
}
.lanrenn-float-service-box {
    display: none;
    position: absolute;
    z-index: 999;
    right: 55px;
    bottom: 0px;
    width: 150px;
    padding: 20px;
    text-align: center;
    border-radius: 4px;
    -webkit-box-shadow: 0 0 3px 1px rgba(0,0,0,.05);
    box-shadow: 0 0 3px 1px rgba(0,0,0,.05);
    transition: all .3s;
    background: #fff;
}
.lanrenn-float-service-box .tops{
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #edf1f2;
}
.lanrenn-float-service-box .tops img{

}
.lanrenn-float-service-box .tops a{
    display: block;
    height: 26px;
    line-height: 26px;
    margin: 15px auto 10px auto;
    border: 1px solid #b5b9bc;
    font-size: 12px;
    border-radius: 4px;
}
.lanrenn-float-service-box .tops a:hover{
    background:#fff0;
    color: var(--primary-color)!important;
    border: 1px solid var(--primary-color)!important;
}
.lanrenn-float-service-box .tops p{
    font-size: 13px;
}
.lanrenn-float-service-box .btms{
    text-align: center;
}
.lanrenn-float-service-box .btms em{
    font-size: 14px;
    color: #5f6575;
    font-weight: 500;
    margin-bottom: 10px;
    height: 20px;
    line-height: 20px;
    display: block;
}
.lanrenn-float-service-box .btms p{
    height: 25px;
    font-weight: 500;
    line-height: 25px;
    font-size: 18px;
    color: #4775FF;
    margin-bottom: 10px;
    display: inline-block;
}
.lanrenn-float-service-box .btms span{
    height: 25px;
    line-height: 25px;
    overflow: hidden;
    font-size: 12px;
    color: #FF5151;
    margin-bottom: 10px;

}

.lanrenn-float-wx-box {
    margin-bottom: 15px;
}
.lanrenn-float-wx-box .boxs p{
    font-size: 14px;
    color: #5f6575;
    font-weight: 500;
    margin-bottom: 10px;
    height: 20px;
    line-height: 20px;
}
.lanrenn-float-wx-box .boxs img {
    width: 100%;
    height: 100%;
    display: block;
    margin-top: 10px;
    padding: 5px;
    border: 1px solid var(--border-color);
    margin: 10px auto 0px auto;
}

.lanrenn-float-ma{
    position: relative;
}
.lanrenn-float-ma:hover .lanrenn-float-ma-box {
  display: block;
  transition: all .3s;
}
.lanrenn-float-ma-box {
    display: none;
    position: absolute;
    z-index: 999;
    right: 54px;
    bottom: 0px;
    width: 170px;
    padding: 10px;
    text-align: center;
    border-radius: 4px;
    -webkit-box-shadow: 0 0 3px 1px rgba(0,0,0,.05);
    box-shadow: 0 0 3px 1px rgba(0,0,0,.05);
    transition: all .3s;
    background: var(--primary-color);
}
.lanrenn-float-ma-box i{
    display: block;
    width: 31px;
    height: 5px;
    margin: 0 auto 10px;
    border-radius: 2px;
    background: #6f96ff;
}
.lanrenn-float-ma-box em{
    display: block;
    margin: 10px auto 0;
    width: 20px;
    height: 20px;
    border-radius: 100%;
    background: #6f96ff;
}
.lanrenn-float-ma-box .tops{
    padding: 10px;
    background: #fff;
    border-radius: 4px;
    text-align: center;
}
.lanrenn-float-ma-box .tops p{
    font-size: 12px;
    color: #5f6575;
    overflow: hidden;
    height: 23px;
    line-height: 23px;
}
.lanrenn-float-ma-box .tops img {
    width: 100%;
    height: 100%;
    display: block;
    margin-top: 10px;
    margin: 10px auto 0px auto;
}
@media screen and (max-width: 767px) {
    .lanrenn-float {
        display: none !important;
    }
}

zibll主题设置 >> 全局功能 >> 自定义代码 >> 自定义Javascript代码

/*
 * @Description     : 自定义悬浮按钮
 * @Url             : https://www.lanrenn.cn/
 * @Email           : 410753470@qq.com
 * @Date            : 2024-01-18 13:14:52
 */
jQuery(document).ready(function($) {
    var $lanrennFloat = $('.lanrenn-float-item.lanrenn-floats');

    $(window).scroll(function() {
        if ($(this).scrollTop() > 200) {
            $lanrennFloat.fadeIn();
        } else {
            $lanrennFloat.fadeOut();
        }
    });

    $lanrennFloat.click(function() {
        $('html, body').animate({ scrollTop: 0 }, 800);
        return false;
    });
});

相关图标

自定义位置存放图标,或者存放在网站根目录/img/float/

悬浮图标下载
密码:
6u2o

👋 感谢您的观看,对您有用就分享出去吧 !

如您有好的资源/素材,可参与创作者激励计划享投稿分成。分成介绍
投稿成功收录,即可获得 1-10元/篇奖励。(重复内容无奖励)
本站代码模板仅供学习交流使用请勿商业运营,严禁从事违法,侵权等任何非法活动,否则后果自负!
子比主题美化-侧边栏自定义悬浮按钮适配多种功能按钮-懒人Blog(资源素材网)
子比主题美化-侧边栏自定义悬浮按钮适配多种功能按钮
此内容为付费阅读,请付费后查看
200积分
安全资源
自动发货
永久使用
售后服务
付费阅读
已售 14
© 版权声明
THE END
文章不错?点个赞呗
点赞1赞赏 分享
评论 共1条

请登录后发表评论

随机看看好帖需要善于发现
热门圈子总有聊不完的话题