-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
568 lines (514 loc) · 24.7 KB
/
index.html
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
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<!-- Optional theme -->
<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">-->
<!-- MapBox.js CSS -->
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.5/mapbox.css' rel='stylesheet' />
<!-- Photo Viewer CSS by Taylor Johnson (two required styles, can be further modified) -->
<link rel="stylesheet" href="photoViewer.css">
<!-- Twitter typeahead CSS by Bass Jobsen -->
<link href="typeaheadjs.css" rel="stylesheet">
<link href='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v0.4.0/MarkerCluster.css' rel='stylesheet' />
<link href='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v0.4.0/MarkerCluster.Default.css' rel='stylesheet' />
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- jQuery Javascript -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<!-- Bootstrap Latest compiled and minified JavaScript -->
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<!-- mapbox.js -->
<script type="text/javascript" src="https://api.tiles.mapbox.com/mapbox.js/v2.1.5/mapbox.js" ></script>
<!-- Load Esri Leaflet from CDN -->
<script src="http://cdn-geoweb.s3.amazonaws.com/esri-leaflet/1.0.0-rc.6/esri-leaflet.js"></script>
<!-- Twitter typeahead.js -->
<script type="text/javascript" src="typeahead.jquery.js"></script>
<script src='//api.tiles.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v0.4.0/leaflet.markercluster.js'></script>
<title>Adopt-A-Beach Sites</title>
<style>
</style>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand hidden-sm hidden-xs" href="http://www.gcmrc.gov/">USGS Grand Canyon Monitoring and Research Center</a>
<a class="navbar-brand visible-sm visible-xs" href="http://www.gcmrc.gov/">USGS GCMRC</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<p class="navbar-text">Adopt-A-Beach Photographs</p>
<form class="navbar-form navbar-right" role="search">
<div class="input-group" id="searchBar">
<input type="text" class="form-control typeahead" placeholder="Search for sites...">
<span class="input-group-btn">
<button type="button" class="btn btn-default" id="search" aria-label="Search for sites" data-toggle="tooltip" data-placement="left" title="Search for sites">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default" id="home" aria-label="Zoom map to full extent" data-toggle="tooltip" data-placement="left" data-container="body" title="Zoom to the Full Map Extent">
<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default" id="options" aria-label="Application Options" data-toggle="tooltip" data-placement="left" title="View options page">
<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
</button>
</span>
</div>
</form>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<!-- <div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="http://www.gcmrc.gov/">Home</a></li>
<li><a href="http://www.gcmrc.gov/research_areas/research_areas_default.aspx">Research Areas</a></li>
<li><a href="http://www.gcmrc.gov/research_areas/sediment_geomorphology/sed/Sed_Geomorph_Home_Page.aspx">Sediment and Geomorphology</a></li>
<li><a href="http://www.gcmrc.gov/sandbar/">Sandbar Monitoring</a></li>
<li class="active">Sandbar Monitoring Photographs</li>
</ol>
</div>
</div> -->
<div class="no-gutter">
<div class="col-md-3" id="sandSidebar" >
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true" style="overflow-y:scroll;">
</div>
<div class="hidden" id="optionsPane">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<h3>Options <small>Filter Photographs</small></h3><hr>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<form>
<p>Please enter optional date range:</p>
<div class="form-group">
<label for="dateStart">Start Date</label>
<input type="date" class="form-control" id="dateStart" placeholder="Date format: mm/dd/yyyy">
</div>
<div class="form-group">
<label for="dateEnd">End Date</label>
<input type="date" class="form-control" id="dateEnd" placeholder="Date format: mm/dd/yyyy">
</div><br>
<p>Please enter optional time range:</p>
<div class="form-group">
<label for="timeStart">Start Time of Day</label>
<input type="time" class="form-control" id="timeStart" placeholder="Time format: hh:mm AM/PM">
</div>
<div class="form-group">
<label for="timeEnd">End Time of Day</label>
<input type="time" class="form-control" id="timeEnd" placeholder="Time format: hh:mm AM/PM">
</div>
<div class="btn-group btn-group-justified" role="group" aria-label="Submit or Reject changes to options">
<div class="btn-group" role="group">
<button type="button" class="btn btn-success"id="saveOpt">Save</button>
</div>
<div class="btn-group" role="group">
<button type="reset" class="btn btn-danger"id="resetOpt">Reset</button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-info" id="dismissOpt">Dismiss</button>
</div>
</div>
</form><hr>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="alert alert-success alert-dismissible" id="saveAlert" role="alert">
<button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Success!</strong> Your settings have been saved.
</div>
<div class="alert alert-danger alert-dismissible" id="resetAlert" role="alert">
<button type="button" class="close" data-hide="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Notice!</strong> Your settings have been reset to default.
</div>
</div>
</div>
</div>
</div>
</div>
<script src='https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-omnivore/v0.2.0/leaflet-omnivore.min.js'></script>
<div class="col-md-9" id="mapDiv">
<div id="map"></div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="imageModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Adopt-A-Beach Photographs</h4>
</div>
<div class="modal-body row no-gutter">
<!-- First Carousel -->
<div id="image-carousel1" class="carousel slide" style="display: none;">
<!-- Indicators -->
<ol class="carousel-indicators">
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
</div>
<!-- Controls -->
<a class='left carousel-control' href='#image-carousel1' role='button' data-slide='prev'>
<span class='glyphicon glyphicon-chevron-left' aria-hidden='true'></span>
<span class='sr-only'>Previous</span>
</a>
<a class='right carousel-control' href='#image-carousel1' role='button' data-slide='next'>
<span class='glyphicon glyphicon-chevron-right' aria-hidden='true'></span>
<span class='sr-only'>Next</span>
</a>
</div>
<!-- Second Carousel (Initially Hidden) -->
<div id="image-carousel2" class="carousel slide" data-interval="false" style="display: none;">
<!-- Indicators -->
<ol class="carousel-indicators">
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
</div>
<!-- Controls -->
<a class='left carousel-control' href='#image-carousel2' role='button' data-slide='prev'>
<span class='glyphicon glyphicon-chevron-left' aria-hidden='true'></span>
<span class='sr-only'>Previous</span>
</a>
<a class='right carousel-control' href='#image-carousel2' role='button' data-slide='next'>
<span class='glyphicon glyphicon-chevron-right' aria-hidden='true'></span>
<span class='sr-only'>Next</span>
</a>
</div>
</div>
<div class='modal-footer'>
<button type='button' class='btn btn-default square pull-left' id='pauseGlyph' aria-label='Pause Photo Carousel'>
<span class='glyphicon glyphicon-pause'></span>
</button>
<button type='button' class='btn btn-default square pull-left' id='playGlyph' aria-label='Play Photo Carousel'>
<span class='glyphicon glyphicon-play'></span>
</button>
<button type='button' class='btn btn-default square pull-right' id='expandGlyph' aria-label='Expand Dual Photo Carousel'>
Dual Viewer <span class="glyphicon glyphicon-menu-right"></span>
</button>
<button type='button' class='btn btn-default square pull-right hidden' id='collapseGlyph' aria-label='Collapse Dual Photo Carousel'>
Dual Viewer <span class='glyphicon glyphicon-menu-left'></span>
</button>
</div>
</div>
</div>
</div>
<script>
$('#map, #accordion, #optionsPane').css("height", ($(window).height() - 52));
$(document).ready(function() {
L.mapbox.accessToken='pk.eyJ1Ijoiam9obnNvbjd1Z2EiLCJhIjoiUDU1VXpCNCJ9.gL2i7S0K2hnw69L5xZlTug';
var map=L.mapbox.map('map');
L.control.layers({
'Shaded-Relief Map': L.mapbox.tileLayer('mapbox.run-bike-hike').addTo(map),
'Satellite Imagery': L.mapbox.tileLayer('mapbox.streets-satellite'),
'Topographic Map': L.mapbox.tileLayer('mapbox.outdoors'),
'Treasure Map': L.mapbox.tileLayer('mapbox.pirates'),
'Retro Map': L.mapbox.tileLayer('mapbox.wheatpaste')
}, {
'GCMRC River Miles': L.esri.dynamicMapLayer('http://grandcanyon.usgs.gov/arcgis/rest/services/BaseLayers/RiverMilesV1022/MapServer/', {position: 'front'}).bringToFront().addTo(map),
'GCMRC Aerial Imagery': L.esri.dynamicMapLayer('http://arcweb.wr.usgs.gov/ArcGIS/rest/services/MapServiceImageryMay2009RGB/MapServer/').bringToBack()
}).addTo(map).setPosition('topleft');
var clusters = new L.markerClusterGroup({
iconCreateFunction: function(cluster) {
return L.mapbox.marker.icon({
'marker-symbol': cluster.getChildCount(),
'marker-color': '#2A81CA'
});
}
});
var layer = omnivore.csv('locations.csv')
.on('error', function(error) {
console.log(error);
})
.on('ready', function(omLayer) {
this.eachLayer(function(marker) {
marker.setIcon(L.icon({
iconUrl: 'http://api.tiles.mapbox.com/mapbox.js/v2.1.5/images/marker-icon.png',
iconSize: [20, 32.8],
iconAnchor: [10, 32],
shadowUrl: 'http://api.tiles.mapbox.com/mapbox.js/v2.1.5/images/marker-shadow.png',
shadowSize: [40, 32.8],
popupAnchor: [0, -32]
}));
marker.bindPopup(marker.toGeoJSON().properties.Site_Name +
'<br><button type="button" id="start" class="btn btn-primary btn-xs trigger" data-toggle="modal" data-target="#imageModal" data-site="'+ marker.toGeoJSON().properties.Site +'">View Photos</button>'
);
clusters.addLayer(marker);
});
map.addLayer(clusters);
map.fitBounds(layer.getBounds());
var gLayer = layer.toGeoJSON(),
site_name, site_lat, site_lon, image_text, thumb_url, site, site_num, site_alt, site_rm, site_size,
searchSites = []; //declare variables outside the loop to avoid multiple declarations per loop iteration.
for (var i = 0, n = gLayer.features.length; i < n; i++) {
site_name = gLayer.features[i].properties.Site_Name;
site_lat = gLayer.features[i].geometry.coordinates[1].toString();
site_lon = gLayer.features[i].geometry.coordinates[0].toString();
//image_text = gLayer.features[i].properties.Image_Text;
//thumb_url = gLayer.features[i].properties.Thumb_URL;
site_alt = gLayer.features[i].properties.Alt_1;
site_rm = gLayer.features[i].properties.RiverMile + gLayer.features[i].properties.River_Side;
site_size = gLayer.features[i].properties.NPS_Size;
site = gLayer.features[i].properties.Site;
site_num = i.toString();
searchSites.push(site_name);
$("#accordion").append(
'<div class="panel panel-default">' +
'<div class="panel-heading" role="tab" id="heading'+ site_num +'">'+
'<h4 class="panel-title">'+
'<a data-toggle="collapse" data-parent="#accordion" href="#collapse'+ site_num +'" aria-expanded="true" aria-controls="collapse'+ site_num +'">'+
site_name +
'</a>'+
'<span class="glyphicon glyphicon-map-marker" aria-hidden="true" style="float:right" data-location="' + site_lat + ',' + site_lon +'" data-toggle="tooltip" data-placement="right" title="Zoom to Location"></span>'+
'</h4>'+
'</div>'+
'<div id="collapse'+ site_num +'" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading'+ site_num +'">'+
'<div class="panel-body">'+
'<table class="table ">'+
'<tr>'+
'<td>Alternate Name</td>'+
'<td>' + site_alt + '</td>'+
'</tr>'+
'<tr>'+
'<td>River Mile</td>'+
'<td>' + site_rm + '</td>'+
'</tr>'+
'<tr>'+
'<td>NPS Camp Size</td>'+
'<td>' + site_size + '</td>'+
'</tr>'+
'<tr>'+
'<td>Latitude (WGS84)</td>'+
'<td>' + site_lat.substring(0, 7) + '° N</td>'+
'</tr>'+
'<tr>'+
'<td>Longitude (WGS84)</td>'+
'<td>' + site_lon.substring(0, 9) + '° W</td>'+
'</tr>'+
'</table>' +
'<br><button type="button" id="start" class="btn btn-primary trigger" data-toggle="modal" data-target="#imageModal" data-site="'+ site + '"style="float:right">View Photos</button>'+
'</div>'+
'</div>'+
'</div>'
);
}
//Activate Go Search button (not complete, Search button manual enabled for now
$('input[type="text"]').on('keyup', function() {
console.log($('input').val());
if (searchSites.indexOf($('input').val()) > -1) {
//$('button#search').removeAttr('disabled');
} else {
//$('button#search').attr('disabled', 'disabled');
}
});
//Go Search button
$('button#search').on('click', function(){
if (searchSites.indexOf($('input.tt-input').val()) > -1) {
map.setView([gLayer.features[searchSites.indexOf($('input.tt-input').val())].geometry.coordinates[1].toString(), gLayer.features[searchSites.indexOf($('input.tt-input').val())].geometry.coordinates[0].toString()], 15);
$('#collapse'+searchSites.indexOf($('input.tt-input').val()).toString()).collapse({parent:'.panel-group'});
$('#collapse'+searchSites.indexOf($('input.tt-input').val()).toString()).collapse('show');
$(location).attr('href', '#collapse'+searchSites.indexOf($('input.tt-input').val()).toString());
$('input.tt-input').val('');
}
else {
alert("Please enter a valid site name to use search");
}
});
//typeahead code
var substringMatcher = function(strs) {
return function findMatches(q, cb) {
var matches = [], substrRegex = new RegExp(q, 'i');
$.each(strs, function(i, str) {
if (substrRegex.test(str)) {
matches.push({value: str});
}
});
cb(matches);
};
};
$('#searchBar .typeahead').typeahead({
hint: true,
highlight: true,
minLength: 1
},
{
name: 'sites',
displayKey: 'value',
source: substringMatcher(searchSites)
});
//Site zoom button
$('.glyphicon-map-marker').on('click', function(){
map.setView($(this).data("location").split(","), 15, {animation: true});
});
//Launch photo viewer
$("#accordion, #map").on( "click", ".trigger", function(e) { //Use higher level selectors (to catch click events at higher level) and then pass a class trigger to focus the event handler function
var site_button = $(this).data("site");
function getToday() {
var today, dd, mm, yyyy
today = new Date();
dd = today.getDate();
mm = today.getMonth()+1;
yyyy = today.getFullYear();
if(dd<10) {
dd='0'+dd;
}
if(mm<10) {
mm='0'+mm;
}
return yyyy+mm+dd;
}
var start_date = $('#dateStart').val().split("-").join("") || "00000000";
var end_date = $('#dateEnd').val().split("-").join("") || getToday();
console.log(site_button + ' - ' + start_date + ' thru ' + end_date);
$.ajax({
type: "GET",
url: "photoCollection.xml",
dataType: "xml",
success: function(xml){
var $images = xml.getElementsByTagName("image"),
count = 0,
site,
url,
caption,
name,
date;
$.each($images, function() {
site = $(this).find("site").text();
url = $(this).find("url").text();
caption = $(this).find("caption").text();
name = $(this).find("name").text();
date = +$(this).find("date").text();
if (site_button.toUpperCase() === site.toUpperCase()) {
if (date <= end_date && date >= start_date) {
if (count==0) {
$('#image-carousel1 .carousel-indicators').append('<li data-target="#image-carousel1" data-slide-to="0" data-toggle="tooltip" data-placement="top" title="'+caption+'" class="active"></li>');
$('#image-carousel1 .carousel-inner').append('<div class="item active"><img src="'+url+'" alt="Image '+count+'"><div class="carousel-caption"><h4>'+caption+'</h4></div></div>');
$('#image-carousel2 .carousel-indicators').append('<li data-target="#image-carousel2" data-slide-to="0" class="active"></li>');
$('#image-carousel2 .carousel-inner').append('<div class="item active"><img src="'+url+'" alt="Image '+count+'"><div class="carousel-caption"><h4>'+caption+'</h4></div></div>');
}
else {
$('#image-carousel1 .carousel-indicators').append('<li data-target="#image-carousel1" data-slide-to="'+count+'" data-toggle="tooltip" data-placement="top" title="'+caption+'"></li>');
$('#image-carousel1 .carousel-inner').append('<div class="item"><img src="'+url+'" alt="Image '+count+'"><div class="carousel-caption"><h4>'+caption+'</h4></div></div>');
$('#image-carousel2 .carousel-indicators').append('<li data-target="#image-carousel2" data-slide-to="'+count+'"></li>');
$('#image-carousel2 .carousel-inner').append('<div class="item"><img src="'+url+'" alt="Image '+count+'"><div class="carousel-caption"><h4>'+caption+'</h4></div></div>');
}
count++;
}
}
});
if(count<1) {
$(".carousel-indicators").empty();
$(".carousel-inner").empty();
$('#image-carousel1 .carousel-indicators').append('<li data-target="#image-carousel1" data-slide-to="0" class="active" style="display:none;"></li>');
$('#image-carousel2 .carousel-indicators').append('<li data-target="#image-carousel2" data-slide-to="0" class="active" style="display:none;"></li>');
$('#image-carousel1 .carousel-inner').append('<div class="item active"><img src="http://www.gcmrc.gov/gis/adopt-a-beach/noImage1.jpg" alt="Image '+count+'"><div class="carousel-caption"><h4>No photographs to display.</h4><h4>Try adjusting the filter criteria.</h4></div></div>');
$('#image-carousel2 .carousel-inner').append('<div class="item active"><img src="http://www.gcmrc.gov/gis/adopt-a-beach/noImage1.jpg" alt="Image '+count+'"><div class="carousel-caption"><h4>No photographs to display.</h4><h4>Try adjusting the filter criteria.</h4></div></div>');
}
}
});
});
// Reset the carousel(s) in the modal once the modal closed
$("#imageModal").on("hidden.bs.modal", function(){
$('#image-carousel1').carousel('pause');
$('#image-carousel2').carousel('pause');
$('#image-carousel1').hide();
$('#image-carousel2').hide();
$('#image-carousel1').removeClass('col-xs-6');
$('#image-carousel2').removeClass('col-xs-6');
$('.modal-dialog').removeClass('dual');
$('#collapseGlyph').addClass('hidden');
$('#expandGlyph').removeClass('hidden');
$(".carousel-indicators").empty();
$(".carousel-inner").empty();
});
// Only show the carousel when the modal is shown
$('#imageModal').on('show.bs.modal', function(){
$('#image-carousel1').show();
$('#image-carousel1').carousel({interval: 4500}); // Set the carousel interval here (in milliseconds). The second carousel is set to not auto-rotate
});
// Pause button for the initial carousel
$('#pauseGlyph').click(function(){
$('#image-carousel1').carousel('pause');
});
// Play button for the intial carousel (automatically increments to next slide)
$('#playGlyph').click(function(){
$('#image-carousel1').carousel('next');
$('#image-carousel1').carousel('cycle');
});
// Enable dual photo viewer (changes the appearance of the modal so carousels are always side-by-side by adding the dual class which sets the width to 95% of the screen)
$('#expandGlyph').click(function(){
$(this).addClass('hidden');
$('#collapseGlyph').removeClass('hidden');
$('#image-carousel1').addClass('col-xs-6');
$('#image-carousel2').addClass('col-xs-6');
$('.modal-dialog').addClass('dual');
$('#image-carousel2').show();
});
// Disables dual photo viewer
$('#collapseGlyph').click(function(){
$(this).addClass('hidden');
$('#expandGlyph').removeClass('hidden');
$('#image-carousel1').removeClass('col-xs-6');
$('#image-carousel2').removeClass('col-xs-6');
$('.modal-dialog').removeClass('dual');
$('#image-carousel2').hide();
});
$(function() {
$('[data-toggle="tooltip"]').tooltip();
});
});
clusters.addLayer(layer).addTo(map);
//Zoom/pan map to full extent
$('#home').on('click', function() {
map.fitBounds(layer.getBounds());
});
});
$('#saveAlert, #resetAlert').hide();
$('#saveOpt').on('click', function() {
$('#saveAlert').show().delay(3500).fadeOut(500);
console.log($('#dateStart').val().split("-").join(""));
//Apply new changes
});
$('#resetOpt').on('click', function() {
//Change the options parameters to the default settings
$('form')[0].reset();
$('#resetAlert').show().delay(3500).fadeOut(500);
});
$('#options, #dismissOpt').on('click', swapPane);
function swapPane() {
$('#accordion, #optionsPane').toggleClass('hidden');
}
$(function() {
$('[data-hide]').on('click', function() {
$(this).closest('.'+ $(this).attr('data-hide')).hide();
});
});
$(window).on('resize', resize);
function resize() {
if ($(window).width()>=980){
$('#map, #accordion, #optionsPane').css('height', ($(window).height()-52));
$('#map').css('margin-top', 0);
}else{
$('#map, #accordion, #optionsPane').css('height', ($(window).height()-64));
$('#map').css('margin-top', -21);
}
}
</script>
</body>