Last active
January 3, 2016 16:29
-
-
Save PiotrKrosniak/8489660 to your computer and use it in GitHub Desktop.
updated style
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| <title>jQuery Slider Fusion Table and Google Maps</title> | |
| <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script> | |
| <script type="text/javascript" src="http://code.jquery.com/ui/1.8.18/jquery-ui.min.js"></script> | |
| <script type='text/javascript' src="http://maps.google.com/maps/api/js?sensor=false&dummy=.js"></script> | |
| <style type='text/css'> | |
| #map-canvas { width:80%; height: 440px; | |
| } | |
| #slider { | |
| height:11px; | |
| left:20px; | |
| background:url(fill.png)no-repeat left; | |
| position:relative; | |
| margin:0; | |
| padding:0 10px; | |
| width:230px; | |
| } | |
| /*Style for the slider button*/ | |
| .ui-slider-handle { | |
| width:24px; | |
| height:24px; | |
| position:absolute; | |
| top:-7px; | |
| margin-left:-12px; | |
| z-index:200; | |
| background:url(slider-button.png); | |
| } | |
| /*Result div where the slider value is displayed*/ | |
| #slider-value { | |
| font-size:50px; | |
| height:200px; | |
| font-family:Arial, Helvetica, sans-serif; | |
| color:#fff; | |
| width:250px; | |
| text-align:center; | |
| text-shadow:0 1px 1px #000; | |
| font-weight:700; | |
| left:20px; | |
| padding:10px 0; | |
| } | |
| a { | |
| outline:none; | |
| -moz-outline-style:none; | |
| } | |
| </style> | |
| <script type="text/javascript"> | |
| var map; | |
| var layer_0; | |
| function initialize() { | |
| map = new google.maps.Map(document.getElementById('map-canvas'), { | |
| center: new google.maps.LatLng(39.77119750801673, 3.1640625), | |
| zoom: 2 | |
| }); | |
| var style = [ | |
| { | |
| featureType: 'all', | |
| elementType: 'all', | |
| stylers: [ | |
| { saturation: -2 } | |
| ] | |
| } | |
| ]; | |
| var styledMapType = new google.maps.StyledMapType(style, { | |
| map: map, | |
| name: 'Styled Map' | |
| }); | |
| map.mapTypes.set('map-style', styledMapType); | |
| map.setMapTypeId('map-style'); | |
| layer_0 = new google.maps.FusionTablesLayer({ | |
| query: { | |
| select: "XXXX-GEOCODED-XXXX", | |
| from: "XXXX-TABLEID-XXXX" | |
| }, | |
| map: map, | |
| styleId: XXX, //FT style in most cases is 2 | |
| templateId: XXXX //FTtemplate ID in most cases is 2 | |
| }); | |
| } | |
| // define the JQuery Slider | |
| $(function() { | |
| $('#slider').slider({ | |
| max: 13000000,//slider max value | |
| min: 1000000,//slider min value | |
| step: 100000,//slider steps | |
| value: 0,//start value | |
| slide: function(event, ui) { | |
| document.getElementById("slider-value").innerHTML = ui.value + " XXXX-TEXT_NEXT_TO_SLIDER-XXXX"; | |
| layer_0.setOptions({ | |
| query: { | |
| select: "XXXX-GEOCODED-XXXX", | |
| from: "XXXX-TABLEID-XXXX, | |
| where: "XXXX-YOUR_DATA_COLUMN_NAME-XXXX <= " + ui.value | |
| } | |
| }); | |
| } | |
| }); | |
| }); | |
| </script> | |
| </head> | |
| <body onload="initialize()"> | |
| <div id="map-canvas"></div> | |
| <div id="slider"; style="top:2px"; //here you can set also slider position | |
| }></div> | |
| <div id="slider-value"; style="font-family:Arial Black, Gadget, sans-serif;color:#7608aa;font-size:20px;text-align:center"></div> | |
| <div id="text"; <p>"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment