共计 834 个字符,预计需要花费 3 分钟才能阅读完成。
效果
导航栏下会有彩色进度条
方法
-
在
usr/themes/handsome/component/headernav.php
底部<!-- / navbar collapse -->
前添加以下代码<div id="percentageCounter"></div>
-
在
主题设置
->开发者设置
->自定义 JavaScript
中插入以下代码
[hide]// 加载显示 $(window).scroll(function() {var a = $(window).scrollTop(), c = $(document).height(), b = $(window).height(); scrollPercent = a / (c - b) * 100; scrollPercent = scrollPercent.toFixed(1); $("#percentageCounter").css({width: scrollPercent + "%"}); }).trigger("scroll");
[/hide]
-
在
主题设置
->开发者设置
->自定义 CSS
中插入以下代码
[hide]// 加载显示 #percentageCounter { position: absolute; z-index: 1; left: 0; bottom: -3px; height: 3px; border-radius: 1.5px; background: linear-gradient(to right, #4cd964, #5ac8fa, #007aff); transition: width 0.45s; }
[/hide]
完成
[scode type=”share”]转载自:https://cmsblog.cn[/scode]
正文完
觉得有用?欢迎赞赏,感谢!