子比主题博客加个底部导航教程

效果图:(夕阳首发,子比官网大佬整理了一份更加通俗易懂的)

子比主题博客加个底部导航教程-星辰解忧

教程开始:

第一步

打开自己网站下的/wp-content/themes/zibll/funactions.php文件,然后把下面的代码加入到文件内。

打开自己网站下的 /wp-content/themes/zibll/footer.php文件,在 </footer> 下面添加下方代码。

<!--底部导航-->
<style>
#footgundong{color: #666;margin-left:20px;overflow: overlay;display: inline-flex;text-align: right;}
.item-foot{color: #666;height: 45px;line-height: 45px;transition: color 0.35s;white-space: nowrap;}
.swal-footer{text-align:center;}
.swal-button {font-size: 20px;}
.count>svg,.count>text{display:none;}
.wz-span{border: 1px solid #999;height:auto;color:#999;font-size:10px;border-radius:2px;padding:0 2px;}
</style>
<div class="footwaveline">
<i style="background-image: url(/images/love.png);display: inline-block;width: 150px;height: 150px;position: fixed;bottom: -5px;z-index: 110;background-size: 100%;"></i>
<div class="footwavewave" style="background: url(/images/dibu1.png) 0 0 repeat-x;height: 3px;width: 100%;position: fixed;background-size: 10px 3px;z-index: 98;bottom: 40px;"></div>
    <div id="shi" style="position: fixed;bottom: 0;margin-left: 200px;z-index: 99;">
       <h4 class="my-face" style="font-size:13px;margin:0 5px 2px -50px;color:#797979;margin-bottom: 10px;">寒江孤影,江湖故人,相逢何必曾相识!</h4>
    </div>
<div style="width: 100%;height: 40px;position: fixed;bottom: 0;z-index: 97;box-shadow: 0 -2px 10px rgb(0 0 0 / 10%);background:#fff;">
    <nav class="joe_header__below-logon" style="float: right;margin-right: 50px;">
        <?php if (is_home()) {
              echo'<style>@media (max-width:1200px){#shi{display:none;}}.pl,.fx{display:none;}.dz{display:none !important;}</style>';
              echo random_posts();
            }elseif (is_page()) {
                echo'<style>@media (max-width:1200px){#shi{display:none;}}.pl,.fx{display:none;}.dz{display:none !important;}</style>';
            }
        ?>
            <span style="margin-left:20px;" class="pl">
                <a href="javascript:(scrollTo('#comments',-100));" data-toggle="tooltip" data-original-title="评论">
                    <svg class="icon" aria-hidden="true"><use xlink:href="#icon-pinglun"></use></svg><span style="color:#666;">评论(<count><?php echo zfunc_comments_users($post->ID); ?></count>)</span>
                </a>
           </span>                
            <span class="dz" style="margin-left:20px;display: inline-block;">
                <a href="javascript:(scrollTo('#comments',-1000));" data-toggle="tooltip" data-original-title="点赞">
                    <svg class="icon" aria-hidden="true"><use xlink:href="#icon-dianzan"></use></svg><span style="color:#666;">点赞(<?php echo dz($post->ID)?>)</span>
                </a>
            </span>
<a class="share-btn poster" poster-share="<?php the_ID();?>" title="海报分享" href="javascript:;">
    <svg class="icon" aria-hidden="true"><use xlink:href="#icon-fenxiang"></use></svg>分享
</a>
            </span>
            <span style="margin-left:20px;line-height: 45px;" class="zs">
                <a id="dorzs" data-toggle="tooltip" data-original-title="赞赏">
                    <svg class="icon" aria-hidden="true"><use xlink:href="#icon-qianbao"></use></svg><span style="color:#666;">赞赏</span>
                </a>
            </span>
        <span style="margin-left:20px;line-height: 45px;" class="sc">
            <a href="javascript:void(0);" id="shoucang" data-toggle="tooltip" data-original-title="收藏">
                <svg class="icon" aria-hidden="true"><use xlink:href="#icon-xihuan"></use></svg><span style="color:#666;">收藏</span>
            </a>
        </span>
        <a style="margin-left:20px; color:#666;" href="javascript:(scrollTo());" id="percentage" data-toggle="tooltip" data-original-title="返回顶部">
            <svg class="icon" aria-hidden="true"><use xlink:href="#icon-dingwei"></use></svg>0%
      </a>
    </nav>
  </div>
</div>

<?php dorzs();?>
<script>
var btn =document.getElementById("shoucang");
btn.onclick = function() {layer.msg('<p style="font-weight:700;margin:5px;">在键盘上按<span style="padding:5px 10px;background:#f0e7e2;border-radius:8px;color:#202020;margin:0 5px;">Ctrl</span>+<span style="padding:5px 10px;background:#f0e7e2;border-radius:8px;color:#202020;margin:0 5px;">D</span>即可<br>喜欢本站的话记得常来哦!</p>', function(){});};
</script>
<!--底部导航-->

引入阿里巴巴矢量库的图标,也可以自行修改

把下面的js跟css引入到你的网站即可

<script src="/video/font_2827587_k24if0ucns.js"></script>
<link rel="stylesheet" type="text/css" href="/video/font_2827587_k24if0ucns.css">
<style type="text/css">.icon {width: 1em; height: 1em;vertical-align: -0.15em;fill: currentColor;overflow: hidden;}</style>
<!-- 引入VUE -->
<script src="/video/vue.min.js"></script>
<!-- 引入样式 -->
<script src="/video/index.js"></script>
<!-- 引入组件库 -->
<link rel="stylesheet" href="/video/index.css">
<!--寒阳社区自用阿里巴巴图标库-->
<script src="//at.alicdn.com/t/c/font_3673004_l6ghs3almxn.js"></script>

JS代码

这段js代码是用来触发滚动条显示百分比的

<!--底部导航滚动进度条百分比-->
$(function(){var $this=$("#footgundong");var scrollTimer;$this.hover(function(){clearInterval(scrollTimer)},function(){scrollTimer=setInterval(function(){scrollNews($this)},2000)}).trigger("mouseleave");function scrollNews(obj){var $self=obj.find("ul");var lineHeight=$self.find("li:first").height();$self.animate({"marginTop":-lineHeight+"px"},500,function(){$self.css({marginTop:0}).find("li:first").appendTo($self)})}})
window.onscroll = function() {
  let scrollNow = window.pageYOffset;
  let pageClientHeight = document.documentElement.clientHeight;
  let scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - pageClientHeight;
  let fullWindowHeightInPercentage = Math.round((scrollNow / scrollHeight) * 100);
  let percentage = document.getElementById('percentage');
  percentage.innerHTML = '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-dingwei"></use></svg> ' + fullWindowHeightInPercentage + '%';
  if (fullWindowHeightInPercentage == 0) percentage.innerHTML = '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-dingwei"></use></svg> 到顶啦';
  if (fullWindowHeightInPercentage == 100) percentage.innerHTML = '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-jiasu1"></use></svg> 到底啦';
}

子比主题博客加个底部导航教程-李小白
子比主题博客加个底部导航教程
此内容为免费阅读,请登录后查看
积分
技术支持
售后服务
网络收集
免费资源每日可下载: 普通用户:10个 蛤蟆将军:30个
免费阅读
© 版权声明
THE END
喜欢就支持一下吧
点赞5 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

夸夸
夸夸
还有吗!没看够!
取消
昵称表情代码图片

    暂无评论内容