This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Create a simple map with Leaflet. This example assumes the map div in the HTML | |
* page has id="map", and that there is a CSS rule for the height of the map div. | |
* documentation: http://leafletjs.com/examples/quick-start/ | |
*/ | |
let mymap = L.map( 'map' ).setView( [30, -90], 9 ) | |
L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' ).addTo( mymap ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The html and body tags have to be 100% in order for the map div to be 100% of the browser window. | |
* This rule assumes the map div has an id="map" | |
*/ | |
html, body, #map { | |
height: 100%; | |
margin: 0; | |
padding: 0 | |
} | |
/* Optionally, leave some space at the top of the body for a Bootstrap nav bar */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Set the height on a div with id="my-div". The height value is in pixels */ | |
#my-div { | |
height: 500px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Listen for a click on the element with id="toggle-map", then either show or hide the element with id="map", | |
* depending on whether it is already visible. The "slow" value is optional; the parameter determines the | |
* speed of the show/hide animation. | |
*/ | |
jQuery( "#toggle-map" ).click(function(){ | |
jQuery( "#map" ).toggle("slow") | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This rule will create a class that will make an element invisible */ | |
.no-display { | |
display: none | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add a visual effect to make an element fade out and fade in | |
*/ | |
jQuery( ".my-style" ).fadeOut("slow") | |
jQuery( ".my-style" ).fadeIn("slow") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Examples of the following types of input elements: text, checkbox, radio button, dropdown, and submit button --> | |
<!-- See the snippet called jquery-input-output.js to see how to get the input values and do something with them --> | |
<!-- text input --> | |
<div class="form-group"> | |
<label for="text1">This is a text input element</label> | |
<input type="text" class="form-control" id="text1" placeholder="Placeholder text here"> | |
</div> | |
<!-- checkboxes --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- For Bootstrap 3. This goes in the <body>. Column widths (the number after "col-md-") in a row must add up to 12. --> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-md-6">First row, left column</div> | |
<div class="col-md-6">First row, right column</div> | |
</div> | |
<div class="row"> | |
<div class="col-md-5">Second row, left column</div> | |
<div class="col-md-7">Second row, right column</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This function will not run until after all HTML elements have loaded. | |
*/ | |
function main(){ | |
// code goes here | |
} | |
jQuery( document ).ready( main ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* When a button with id="submit" is clicked, get the value of a few types of input fields. | |
* See the snippet called bootstrap-form-input.html for HTML of the form elements that could | |
* be used with this code. | |
*/ | |
jQuery( "#submit" ).click(function(){ | |
let text = jQuery( "#text1" ).val() | |
let checkbox1 = jQuery( "#checkbox1" ).is( ":checked" ) | |
let checkbox2 = jQuery( "#checkbox2" ).is( ":checked" ) | |
let radio = jQuery( "input[name=basemap]:checked" ).val() | |
let select = jQuery( "#select1 option:selected" ).val() |