个性博客自定义导航
自定义博客园导航
博客园默认的给出了几个导航:博客园、首页、新随笔、联系我、管理等等。这里做的是在博客园给出的导航里增加自己的导航或移除博客园给的导航
代码的效果,可以参考博主的导航!JS复制链接到浏览器上即可查看
添加导航 $navList.cnblogsNav('addNav', 导航索引值, '导航名称', '导航链接'); 移除导航 $navList.cnblogsNav('removeNav', 导航索引值);
点击查看代码
<!--自定义导航-->
<script src="https://blog-static.cnblogs.com/files/blogs/725648/blogs-custom-nav.js"></script>
<script type="text/javascript">
$(function() {
var $navList = $('#navList');
$navList.cnblogsNav('addNav', 3, '随笔', 'https://www.cnblogs.com/moranjl/p');
$navList.cnblogsNav('addNav', 4, '文章', 'https://www.cnblogs.com/moranjl/category/2101877.html');
$navList.cnblogsNav('addNav', 5, '日记', 'https://www.cnblogs.com/moranjl/MyDiary.html');
$navList.cnblogsNav('addNav', 6, '相册', 'https://www.cnblogs.com/moranjl/gallery/2101260.html');
$navList.cnblogsNav('removeNav', 2);
$navList.cnblogsNav('removeNav', 7);
});
</script>
<style>
#navList {text-align: center}
#navList li {display: inline-block;padding: 1rem 1.5rem;color: #95a5a6;text-align: center;font-size: 18px;font-family: 'Josefin Sans Light',-apple-system,BlinkMacSystemFont,"Helvetica Neue","PingFang SC","'Hiragino Sans GB",STHeiti,"Microsoft Yahei","Source Han Sans SC","Noto Sans CJK SC","WenQuanYi Micro Hei",Arial,Verdana,sans-serif;}
#navList li a {text-shadow: none;}
#navList li a:hover {color: #807dd4;font-weight: 500;}
.navigator.static {position: fixed;top: 0;right: 0;left: 0;z-index: 9;box-sizing: border-box;padding: 0;width: 100% !important;height: 65px;background: hsla(0,0%,100%,.8);box-shadow: 0 1px 3px rgb(26 26 26 / 10%);}
.navigator.static:hover {background: #fff;transition: 0.1s;}
.navigator.static #navList li {padding: 0 1rem;line-height: 65px;}
</style>
蓦然、回首,那人就在灯火阑珊处