From 02af96794734b2ed8431eeefe5a4fc8e56c67224 Mon Sep 17 00:00:00 2001 From: BigCoke233 Date: Wed, 15 Apr 2020 18:01:08 +0800 Subject: =?UTF-8?q?:bird:=20Perf:=20=E5=B9=B3=E6=BB=91=E7=9A=84=E9=94=9A?= =?UTF-8?q?=E7=82=B9=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/miracles.min.js | 15 ++++++++++++++- libs/Contents.php | 5 ++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/assets/js/miracles.min.js b/assets/js/miracles.min.js index 1b6eb89..1db4b4c 100644 --- a/assets/js/miracles.min.js +++ b/assets/js/miracles.min.js @@ -142,12 +142,24 @@ $('#gotop').hide(); $(window).scroll(function() { if ($(window).scrollTop() > 450) { scaleIn($('#gotop'), '0.7'); - scaleIn($('#gotop'), '0.7'); } else { scaleOut($('#gotop'), '0.7'); } }); +/** + * Anchor Link Animation + */ +function anchorAniLoad(){ + $('a[href^="#"]').click(function(){ + $('html, body').animate({ + scrollTop: $($.attr(this, 'href')).offset().top + }, 400); + return false; + }); +} +anchorAniLoad(); + /** * Js Loader */ @@ -504,6 +516,7 @@ if (loadPjax = true) { navColor(); //Link linkTarget(); + anchorAniLoad(); //comment MiraclesComment.bindReplyBtn(); //Bind Reply Button MiraclesComment.core(); //Comment Core diff --git a/libs/Contents.php b/libs/Contents.php index 75aa833..256ff46 100644 --- a/libs/Contents.php +++ b/libs/Contents.php @@ -229,7 +229,10 @@ class Contents static public function parseHeaderCallback($matchs) { // 增加单独标记,否则冲突 - $id = 'toc_'.(self::$CurrentTocID++); + $id = $matchs[3]; + $id = str_replace(' ','\%20',$id); + $id = str_replace('&','\%26',$id); + $id = str_replace('?','\%3F;',$id); return ''.$matchs[3].''; } -- cgit v1.2.3