質問編集履歴

2

質問内容の修正

2020/05/18 09:42

投稿

satoru225Simple
satoru225Simple

スコア27

test CHANGED
File without changes
test CHANGED
@@ -444,7 +444,7 @@
444
444
 
445
445
  以下、テストになります。
446
446
 
447
- [リンク内容](https://codepen.io/satoru1993/pen/LYPzQWK?editors=1010)
447
+ [https://codepen.io/satoru1993/pen/LYPzQWK?editors=1010](https://codepen.io/satoru1993/pen/LYPzQWK?editors=1010)
448
448
 
449
449
 
450
450
 

1

ソースの修正

2020/05/18 09:42

投稿

satoru225Simple
satoru225Simple

スコア27

test CHANGED
File without changes
test CHANGED
@@ -62,6 +62,30 @@
62
62
 
63
63
  ```js
64
64
 
65
+ $(function(){
66
+
67
+ $('a[href^="#"]').click(function() {
68
+
69
+ var scrollSpeed = 400;
70
+
71
+ var href= $(this).attr("href");
72
+
73
+ var target = $(href === "#" || href === "" ? 'html' : href);
74
+
75
+ var position = target.offset().top;
76
+
77
+
78
+
79
+ $('body,html').animate({scrollTop:position}, scrollSpeed, 'swing');
80
+
81
+ return false;
82
+
83
+ });
84
+
85
+ });
86
+
87
+
88
+
65
89
  $(function () {
66
90
 
67
91
 
@@ -392,27 +416,7 @@
392
416
 
393
417
 
394
418
 
395
- $(function(){
419
+
396
-
397
- $('a[href^="#"]').click(function() {
398
-
399
- var scrollSpeed = 400;
400
-
401
- var href= $(this).attr("href");
402
-
403
- var target = $(href === "#" || href === "" ? 'html' : href);
404
-
405
- var position = target.offset().top;
406
-
407
-
408
-
409
- $('body,html').animate({scrollTop:position}, scrollSpeed, 'swing');
410
-
411
- return false;
412
-
413
- });
414
-
415
- });
416
420
 
417
421
  ```
418
422