質問編集履歴

1

コード修正

2019/11/28 23:23

投稿

tomo39-.
tomo39-.

スコア27

test CHANGED
File without changes
test CHANGED
@@ -6,15 +6,141 @@
6
6
 
7
7
 
8
8
 
9
- ![イメージ説明](550f5c73a9a1e8d1d058dfd06bf6802b.png)
10
-
11
9
 
12
10
 
13
11
 
14
12
 
15
13
  ```ここに言語を入力
16
14
 
15
+ <!doctype html>
16
+
17
+ <html lang="en">
18
+
19
+
20
+
21
+ <head>
22
+
23
+
24
+
25
+ <!-- CSS & Fonts -->
26
+
27
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
28
+
29
+ integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
30
+
31
+
32
+
33
+ <!-- JS -->
34
+
35
+
36
+
37
+ <script>
38
+
39
+ $('.navbar-nav>li>a').on('click', function () {
40
+
41
+ $('.navbar-collapse').collapse('hide');
42
+
43
+ });
44
+
45
+
46
+
47
+ $(document).ready(function () {
48
+
49
+ $(document).on("scroll", onScroll);
50
+
51
+ //smoothscroll
52
+
53
+ $('a[href*="#"]')
54
+
55
+ .not('[href="#"]')
56
+
57
+ .not('[href="#0"]')
58
+
59
+ .not('[href="#carouselTestimonials"]')
60
+
61
+ .on('click', function (e) {
62
+
63
+ event.preventDefault();
64
+
65
+ $(document).off("scroll");
66
+
67
+
68
+
69
+ $('a').each(function () {
70
+
71
+ $(this).removeClass('active');
72
+
73
+ })
74
+
75
+ $(this).addClass('active');
76
+
77
+
78
+
79
+ var target = this.hash,
80
+
81
+ menu = target;
82
+
83
+ $target = $(target);
84
+
85
+ $('html, body').stop().animate({
86
+
87
+ 'scrollTop': $target.offset().top - 80
88
+
89
+ }, 1000, function () {
90
+
91
+ $(document).on("scroll", onScroll);
92
+
93
+ });
94
+
95
+ return false;
96
+
97
+ });
98
+
99
+ });
100
+
101
+
102
+
103
+ function onScroll(event) {
104
+
105
+ var scrollPos = $(document).scrollTop();
106
+
107
+ $('#navbarNav a').each(function () {
108
+
109
+ var currLink = $(this);
110
+
111
+ var refElement = $(currLink.attr("href"));
112
+
113
+ if (refElement.position().top - 80 <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
114
+
115
+ $('#navbarNav ul li a').removeClass("active"); //added to remove active class from all a elements
116
+
117
+ currLink.addClass("active");
118
+
119
+ }
120
+
121
+ else {
122
+
123
+ currLink.removeClass("active");
124
+
125
+ }
126
+
127
+ });
128
+
129
+ }
130
+
131
+ </script>
132
+
133
+
134
+
135
+
136
+
137
+ </head>
138
+
139
+ <body>
140
+
141
+ <!-- TESTIMONIALS -->
142
+
17
- <div id="carouselTestimonials" class="carousel slide" data-ride="carousel">
143
+ <div id="carouselTestimonials" class="carousel slide" data-ride="carousel">
18
144
 
19
145
  <ol class="carousel-indicators">
20
146
 
@@ -128,6 +254,40 @@
128
254
 
129
255
  </div>
130
256
 
257
+
258
+
259
+ <!-- Optional JavaScript -->
260
+
261
+ <!-- jQuery first, then Popper.js, then Bootstrap JS -->
262
+
263
+ <script src="https://code.jquery.com/jquery-3.3.1.min.js"
264
+
265
+ integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
266
+
267
+ <script>
268
+
269
+ window.jQuery || document.write('<script src="js/vendor/jquery-3.3.1.min.js"></script>')
270
+
271
+ </script>
272
+
273
+ <script type="text/javascript" src="js/main.js"></script>
274
+
275
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
276
+
277
+ integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
278
+
279
+ crossorigin="anonymous"></script>
280
+
281
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
282
+
283
+ integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFW" index="-1" role="dialog" crossorigin="anonymous">
284
+
285
+
286
+
287
+ </body>
288
+
289
+ </html>
290
+
131
291
 
132
292
 
133
293
  ```