-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
483 lines (468 loc) · 20.9 KB
/
Copy pathindex.html
File metadata and controls
483 lines (468 loc) · 20.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<link href="https://fonts.googleapis.com/css?family=Comfortaa" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script defer src="https://use.fontawesome.com/releases/v5.0.8/js/all.js"></script>
<script type="text/javascript" src="jquery-ias.min.js"></script>
<title>Google Maps|Autocomplete Directions</title>
<style>
html, body {
height: 77%;
width: 48rem;
padding: 0;
margin: 0 auto;
font-family: 'Comfortaa', cursive;
flex-flow: row;
}
h1 {
text-align: center;
color: #EDA725;
letter-spacing: 7.7px;
}
i:hover {
color: #EDA725;
}
p {
line-height: 2.48;
}
/*map styles*/
#map {
height: 100%;
}
.controls {
margin-top: 10px;
border: 1px solid transparent;
border-radius: 2px 0 0 2px;
box-sizing: border-box;
-moz-box-sizing: border-box;
height: 32px;
outline: none;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
#origin-input,
#destination-input {
background-color: #fff;
font-size: 15px;
font-weight: 300;
margin-left: 12px;
padding: 0 11px 0 13px;
text-overflow: ellipsis;
width: 200px;
}
#origin-input:focus,
#destination-input:focus {
border-color: #4d90fe;
}
#mode-selector {
color: #fff;
background-color: #4d90fe;
margin-left: 12px;
padding: 5px 11px 0px 11px;
}
#mode-selector label {
font-size: 13px;
font-weight: 300;
}
/*menu styles*/
.hamburger-shell {
margin: 0;
position: fixed;
overflow: hidden;
width: 70px;
height: 100px;
overflow: auto;
left: calc(100% - 100px);
top: 20px;
}
.top, .middle {
position: absolute;
width: 62px;
height: 10px;
background-color: black;
transition: all 350ms ease-in-out;
top: 20px;
}
.middle {
top: 40px;
}
#menu {
position: fixed;
left: calc(100% - 292px);
top: 10px;
color: black;
display: none;
margin: 120px 30px;
text-decoration: none;
font-family: 'Comfortaa', cursive;
font-weight: 100;
font-size: 20px;
text-transform: lowercase;
color: #333;
padding: 24px;
width: 200px;
text-align: right;
}
#menu a li {
text-decoration: none!important;
padding-bottom: 10px;
margin-bottom: 12px;
border-bottom: 1px solid black;
list-style: none;
color: #555;
transition: all 150ms ease;
}
#menu a li:hover {
color: #EDA725;
padding-right: 3px;
}
#menu a {
text-decoration: none;
}
.rotate {
transform: rotate(225deg);
-webkit-transform: rotate(225deg);
top: 30px;
background-color: #EDA725;
height: 2px;
}
.rotate-back {
transform: rotate(-225deg);
-webkit-transform: rotate(-225deg);
top: 30px;
background-color: #EDA725;
height: 2px;
}
.top {
-webkit-animation-delay: 100ms;
}
.middle {
-webkit-animation-delay: 250ms;
}
.bottom {
-webkit-animation-delay: 400ms;
}
.menu-name {
font-family: 'Comfortaa', cursive;
font-weight: 900;
color: black;
font-size: 19.5px;
text-decoration: none;
position: absolute;
top: 56px;
left: -1px;
transition: all 350ms;
}
/* Bounce In */
.hvr-bounce-in {
display: inline-block;
vertical-align: middle;
-webkit-transform: perspective(3px) translateZ(0);
transform: perspective(3px) translateZ(0);
box-shadow: 0 0 2px transparent;
-webkit-transition-duration: 1.9s;
transition-duration: 0.5s;
color: black;
}
.hvr-bounce-in:hover, .hvr-bounce-in:focus, .hvr-bounce-in:active {
-webkit-transform: scale(2.2);
transform: scale(2.2);
-webkit-transition-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);
transition-timing-function: cubic-bezier(0.47, 2.02, 0.31, -0.36);
color: #EDA725;
}
/* Grow Shadow */
.hvr-grow-shadow {
vertical-align: middle;
-webkit-transform: perspective(1px) translateZ(0);
transform: perspective(1px) translateZ(0);
box-shadow: 0 0 1px transparent;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: box-shadow, transform;
transition-property: box-shadow, transform;
}
.hvr-grow-shadow:hover, .hvr-grow-shadow:focus, .hvr-grow-shadow:active {
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.5);
-webkit-transform: scale(4.8);
transform: scale(2.2);
}
/*Google icon hover effect*/
#hoverEffect {
margin: 15px 0;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
}
#hoverEffect:hover {
height: 133px;
width: 400px;
color: #EDA725;
}
/*animate from top effects*/
.animate-top {
position: relative;
animation: animatetop 0.4s;
}
@keyframes animatetop {
from {
top: -300px;
opacity: 0
}
to {
top: 0;
opacity: 1
}
}
/*powered by Google styles*/
.google {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
@-webkit-keyframes google {
25% {
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
75% {
-webkit-transform: scale(0.9);
transform: scale(0.9);
}
}
@keyframes google {
25% {
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
75% {
-webkit-transform: scale(0.9);
transform: scale(0.9);
}
}
.google:hover, .google:focus, .google:active {
-webkit-animation-name: google;
animation-name: google;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
</style>
</head>
<body>
<a class="hamburger-shell">
<div class="hamb top"></div>
<div class="hamb middle"></div>
<div class="menu-name">MENU</div>
<ul id="menu">
<a href="#top">
<li>Top</li>
</a>
<a href="https://kev-n.github.io">
<li>Home</li>
</a>
<a href="index.html">
<li>Autocomplete Directions</li>
</a>
<a href="rotatingSatImagery.html">
<li>Rotating Satelite</li>
</a>
<a href="mapSearch.html">
<li>Map Search</li>
</a>
</ul>
</a>
<div class="animate-top">
<div class="item">
<h1>Google Maps</h1>
<a href="https://developers.google.com" target="none">
<div class="hvr-bounce-in" style="display: table; margin: 0 auto; position: relative; color: black;">
<i class="fab fa-google" id="hoverEffect"></i>
</div>
</a>
<h1>Autocomplete Directions</h1>
</div>
<div class="item">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ultricies ex in ipsum elementum, ut posuere ipsum aliquet. Suspendisse tincidunt sem eu dictum dictum. Nullam elementum ultricies purus venenatis fermentum. Etiam faucibus justo sit amet quam
consectetur, et egestas nisi fringilla. Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut blandit nisi odio, vitae blandit nisl bibendum nec. In placerat orci nec metus vehicula pulvinar. Pellentesque ultrices ultricies
nisl eu scelerisque. Sed vestibulum molestie condimentum. Pellentesque maximus lacinia turpis, non lacinia nulla pharetra vel. Sed vitae pharetra lacus. Etiam et tempus nisi.</p>
</div>
<div class="item">
<p>Vivamus pharetra ipsum laoreet, accumsan leo nec, iaculis ante. Aenean a arcu cursus, rutrum magna eget, sagittis sem. Sed nec sapien et felis hendrerit cursus vel et risus. Vestibulum vestibulum volutpat nisi sit amet rhoncus. Sed sed elementum
tortor. Proin auctor finibus nisi, ac commodo felis convallis et. Curabitur at rhoncus risus.</p>
</div>
<div class="item">
<p>In maximus ante non nibh viverra egestas. Integer id sem sapien. Aenean vehicula suscipit ex ac malesuada. Nulla varius turpis tellus, nec placerat elit venenatis vehicula. Aenean consequat, libero ac aliquam accumsan, urna felis dictum lorem,
et porta odio nisl et arcu. Aliquam eleifend nec tortor vitae suscipit. Fusce a enim volutpat, laoreet magna quis, blandit quam. Nulla tempor elementum tristique. Etiam accumsan ante ac felis vestibulum aliquam ut eget arcu. Etiam a lacinia
odio, sed sagittis orci. Nunc posuere nunc rutrum faucibus iaculis. In accumsan pretium neque, sed aliquet magna.</p>
</div>
<div class="item">
<p>Morbi luctus velit ut nisl ultricies, congue posuere dolor vulputate. Vestibulum mollis placerat molestie. Morbi at lectus pharetra, fermentum tortor a, auctor felis. Curabitur lorem ante, viverra ac auctor ut, cursus sed nisi. Aenean quis
nunc turpis. Nulla facilisis commodo ipsum et porta. Nunc vitae enim ut mi viverra porta. Nam nunc diam, consectetur eu posuere eu, feugiat eget orci.</p>
</div>
<div class="item">
<p>Donec condimentum, erat vitae molestie fringilla, justo orci tempus turpis, sit amet tincidunt turpis ipsum a felis. Phasellus euismod feugiat elit non bibendum. Morbi non neque dictum velit iaculis aliquam et at turpis. Curabitur dictum vulputate
imperdiet. Phasellus id imperdiet eros. Duis aliquam, purus in tincidunt interdum, urna neque ultricies ipsum, a pretium arcu turpis at nisi. Fusce neque nulla, facilisis at tincidunt non, ullamcorper suscipit lectus.</p>
</div>
<div class="item">
<p>Curabitur eu lacus pretium, sollicitudin elit et, tempus felis. Vestibulum facilisis ipsum ac erat sagittis sagittis. Vestibulum tempus placerat enim, sit amet efficitur lacus sagittis vitae. Etiam volutpat odio quis nisl pulvinar sollicitudin.
Mauris ullamcorper laoreet dui, vestibulum iaculis ex. Nulla porta ante eu nibh scelerisque, et convallis libero ultricies. Donec vel egestas diam. Phasellus vel nibh ultricies, scelerisque enim non, feugiat tortor. Phasellus dictum augue
eget nibh efficitur vehicula. Integer enim libero, dignissim non mollis at, luctus et tellus. Donec eget purus vehicula, bibendum libero suscipit, tincidunt arcu. Nam vel ligula sit amet metus vestibulum blandit. Morbi mauris ex, molestie
vitae bibendum in, convallis in lacus.</p>
</div>
</div>
<input id="origin-input" class="controls" type="text" placeholder="Enter an origin location">
<input id="destination-input" class="controls" type="text" placeholder="Enter a destination location">
<div id="mode-selector" class="controls" class="item">
<input type="radio" name="type" id="changemode-walking" checked="checked">
<label for="changemode-walking">Walking</label>
<input type="radio" name="type" id="changemode-transit">
<label for="changemode-transit">Transit</label>
<input type="radio" name="type" id="changemode-driving">
<label for="changemode-driving">Driving</label>
</div>
<div id="map"></div>
<div class="item">
<p>Sed sagittis dui eu tellus gravida, in ullamcorper purus dapibus. Integer at metus quis nulla condimentum lobortis ac sagittis arcu. Fusce in orci a tellus consequat convallis in et leo. Fusce posuere, odio ac laoreet tristique, turpis arcu egestas
justo, sit amet posuere magna magna at turpis. Suspendisse ac elit non odio commodo lobortis. Sed nibh nisi, ultricies et lacinia at, mollis non enim. Suspendisse imperdiet, orci mollis suscipit consequat, massa augue faucibus ligula, imperdiet
convallis turpis sem sit amet tortor. Morbi commodo iaculis venenatis. Vestibulum tincidunt tellus ac tempor consectetur. Praesent efficitur pellentesque mattis. Nulla posuere dictum est id dignissim.
</p>
</div>
<div id="pagination">
<div id="pagination">
<li><a href="index.html">1</a></li>
<li class="next"><a href="html5.html">2</a></li>
<li><a href="css3.html">3</a></li>
<li><a href="js.html">4</a></li>
</div>
</div>
<a class="hvr-bounce-in" href="https://github.com/kev-n" style="display: table; margin: 0 auto; position: relative;" target="none"><i class="fab fa-github"></i></a>
<p class="hvr-grow-shadow" style="text-align:center; letter-spacing: -2.2px;">Designed<i class="fas fa-code" style="color: #EDA725;"></i>Developed By Kev Web Dev</p>
<script>
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
mapTypeControl: false,
center: { lat: 47.616231, lng: -122.340205},
zoom: 17,
scaleControl: true,
rotateControl: true
});
new AutocompleteDirectionsHandler(map);
}
function AutocompleteDirectionsHandler(map) {
this.map = map;
this.originPlaceId = null;
this.destinationPlaceId = null;
this.travelMode = 'WALKING';
var originInput = document.getElementById('origin-input');
var destinationInput = document.getElementById('destination-input');
var modeSelector = document.getElementById('mode-selector');
this.directionsService = new google.maps.DirectionsService;
this.directionsDisplay = new google.maps.DirectionsRenderer;
this.directionsDisplay.setMap(map);
//google.maps.places.Autocomplete provides Place predictions based on a user's text input. It attaches to an input element of type text, and listens for text entry in that field. The list of predictions is presented as a drop-down list, and is updated as text is entered.
var originAutocomplete = new google.maps.places.Autocomplete(
originInput, {placeIdOnly: true});
var destinationAutocomplete = new google.maps.places.Autocomplete(
destinationInput, {placeIdOnly: true});
this.setupClickListener('changemode-walking', 'WALKING');
this.setupClickListener('changemode-transit', 'TRANSIT');
this.setupClickListener('changemode-driving', 'DRIVING');
this.setupPlaceChangedListener(originAutocomplete, 'ORIG');
this.setupPlaceChangedListener(destinationAutocomplete, 'DEST');
this.map.controls[google.maps.ControlPosition.TOP_LEFT].push(originInput);
this.map.controls[google.maps.ControlPosition.TOP_LEFT].push(destinationInput);
this.map.controls[google.maps.ControlPosition.TOP_LEFT].push(modeSelector);
}
//radio button listener to filter autocomplete places
AutocompleteDirectionsHandler.prototype.setupClickListener = function(id, mode) {
var radioButton = document.getElementById(id);
var me = this;
radioButton.addEventListener('click', function() {
me.travelMode = mode;
me.route();
});
};
//radio buttons with listener for Places filter
AutocompleteDirectionsHandler.prototype.setupPlaceChangedListener = function(autocomplete, mode) {
var me = this;
autocomplete.bindTo('bounds', this.map);
autocomplete.addListener('place_changed', function() {
var place = autocomplete.getPlace();
if (!place.place_id) {
window.alert("Please select an option from the dropdown list.");
return;
}
if (mode === 'ORIG') {
me.originPlaceId = place.place_id;
} else {
me.destinationPlaceId = place.place_id;
}
me.route();
});
};
AutocompleteDirectionsHandler.prototype.route = function() {
if (!this.originPlaceId || !this.destinationPlaceId) {
return;
}
var me = this;
// create an object of type DirectionsService and call DirectionsService.route() to initiate a request to the Directions service, passing it a DirectionsRequest object literal containing the input terms and a callback method to execute upon receipt of the response.
this.directionsService.route({
origin: {'placeId': this.originPlaceId},
destination: {'placeId': this.destinationPlaceId},
travelMode: this.travelMode
}, function(response, status) {
if (status === 'OK') {
me.directionsDisplay.setDirections(response);
} else {
window.alert('Directions request failed due to ' + status);
}
});
};
//Jquery - sticky hamburger
$(document).ready(function() {
$('.hamburger-shell').click(function() {
$('#menu').slideToggle(300);
$('.top').toggleClass('rotate');
$('.middle').toggleClass('rotate-back');
$('.menu-name').toggleClass('bump');
$('.bg-cover').toggleClass('reveal');
});
$('.bg-cover').click(function() {
$('#menu').slideToggle(300);
$('.top').toggleClass('rotate');
$('.middle').toggleClass('rotate-back');
$('.menu-name').toggleClass('bump');
$('.bg-cover').toggleClass('reveal');
})
});
//InfiniteAjaxScrolling configurations
// JQuery mapping:
var ias = $.ias({
// selector of the element containing your items that you want to paginate
container: ".container",
// selector of the element that each item has. Make sure the elements are inside the container element.
item: ".item",
// selector of the element that contains your regular pagination links, like next, previous and the page numbers
pagination: "#pagination",
// selector of the link element that links to the next page
next: ".next a"
});
// Add a loader image which is displayed during loading
ias.extension(new IASSpinnerExtension());
// Add a link after page 3 which has to be clicked to load the next page
ias.extension(new IASTriggerExtension({offset: 3}));
// Add a text when there are no more pages left to load
ias.extension(new IASNoneLeftExtension({text: 'There are no more pages left to load.'}));
</script>
<!--the Places Library is required for autocomplete to work.-->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDDuGt0E5IEGkcE6ZfrKfUtE9Ko_de66pA&libraries=places&callback=initMap" async defer></script>
</body>
</html>