// create a map
// set pannable and scroll options based on current input values
// in case the browser has cached them
var map = $( "#map" ).geomap( {
center: [ -71.0595678, 42.3604823 ],
zoom: 8,
pannable: $( "#pannable" ).prop( "checked" ),
scroll: $( "input[name='scroll']:checked" ).val( )
} );
$( "#pannable" ).button( ).click( function( ) {
// toggle the pannable option based on the state
// of the pannable button
map.geomap( "option", "pannable", this.checked );
} );
$( "#scroll" ).buttonset( ).find( "input" ).click( function( ) {
// set the scroll option based on the currently checked radio's value
var scrollValue = $( "input[name='scroll']:checked" ).val( );
map.geomap( "option", "scroll", scrollValue );
} );
<div id="map">
</div>
<div class="info">
<h1>panning & scroll</h1>
<p>The panning option can remove a user's ability to pan the map. The scroll option can remove a user's ability to use the mouse wheel to zoom.</p>
<p class="not-mobile">scroll options default and zoom work the same.</p>
<fieldset>
<legend>pannable (click to toggle)</legend>
<input type="checkbox" id="pannable" checked="checked" /><label for="pannable">pannable</label>
</fieldset>
<fieldset>
<legend>scroll</legend>
<div id="scroll">
<input type="radio" id="default" name="scroll" value="default" checked="checked" /><label for="default">default</label>
<input type="radio" id="zoom" name="scroll" value="zoom" /><label for="zoom">zoom</label>
<input type="radio" id="off" name="scroll" value="off" /><label for="off">off</label>
</div>
</fieldset>
html
{
font:13px/1.231 Calibri,Arial,sans-serif; *font-size:small;
}
.info
{
background: #fff;
border-radius: 8px;
box-shadow: -4px 4px #444;
opacity: .8;
padding: 8px;
width: 95%;
}
fieldset { border: none; }
legend {
font-size: 14px;
font-weight: bold;
}
#map
{
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
External resources loaded into this fiddle: