diff options
| author | BigCoke233 <hi@guhub.cn> | 2020-04-15 18:01:08 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2020-04-15 18:01:08 +0800 |
| commit | 02af96794734b2ed8431eeefe5a4fc8e56c67224 (patch) | |
| tree | 7ada9fe281c3af8c17f45f190ed0a26f8740c982 /assets/js | |
| parent | 3def1ca01fc20e6f6da887182202f10047e3a912 (diff) | |
:bird: Perf: 平滑的锚点动画
Diffstat (limited to 'assets/js')
| -rw-r--r-- | assets/js/miracles.min.js | 15 |
1 files changed, 14 insertions, 1 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,13 +142,25 @@ $('#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
*/
//LazyLoad
@@ -504,6 +516,7 @@ if (loadPjax = true) { navColor();
//Link
linkTarget();
+ anchorAniLoad();
//comment
MiraclesComment.bindReplyBtn(); //Bind Reply Button
MiraclesComment.core(); //Comment Core
|
