inactive_regions.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <title>JQVMap - USA Map</title>
  6. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  7. <link href="../dist/jqvmap.css" media="screen" rel="stylesheet" type="text/css"/>
  8. <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
  9. <script type="text/javascript" src="../dist/jquery.vmap.js"></script>
  10. <script type="text/javascript" src="../dist/maps/jquery.vmap.usa.js" charset="utf-8"></script>
  11. <script>
  12. var map;
  13. jQuery(document).ready(function () {
  14. // Store currentRegion
  15. var currentRegion = 'fl';
  16. // List of Regions we'll let clicks through for
  17. var enabledRegions = ['mo', 'fl', 'or'];
  18. map = jQuery('#vmap').vectorMap({
  19. map: 'usa_en',
  20. enableZoom: true,
  21. showTooltip: true,
  22. selectedColor: '#333333',
  23. selectedRegions: ['fl'],
  24. hoverColor: null,
  25. colors: {
  26. mo: '#C9DFAF',
  27. fl: '#C9DFAF',
  28. or: '#C9DFAF'
  29. },
  30. onRegionClick: function(event, code, region){
  31. // Check if this is an Enabled Region, and not the current selected on
  32. if(enabledRegions.indexOf(code) === -1 || currentRegion === code){
  33. // Not an Enabled Region
  34. event.preventDefault();
  35. } else {
  36. // Enabled Region. Update Newly Selected Region.
  37. currentRegion = code;
  38. }
  39. },
  40. onRegionSelect: function(event, code, region){
  41. console.log(map.selectedRegions);
  42. },
  43. onLabelShow: function(event, label, code){
  44. if(enabledRegions.indexOf(code) === -1){
  45. event.preventDefault();
  46. }
  47. }
  48. });
  49. });
  50. </script>
  51. </head>
  52. <body>
  53. <div id="vmap" style="width: 600px; height: 400px;"></div>
  54. </body>
  55. </html>