Generate Google/Bing Map Links From Postcodes/Zipcodes - jQuery mapIt

File Size: 7.4 KB
Views Total: 787
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Generate Google/Bing Map Links From Postcodes/Zipcodes - jQuery mapIt

mapIt is a simple jQuery plugin that automatically generates clickable Google Maps and/or Bing Maps links from postcodes/zipcodes you provide.

How to use it:

1. Load the minified version of the jQuery mapIt plugin after loading jQuery library.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous">
</script>
<script src="src/jquery.mapIt.min.js"></script>

2. Call the function on the element containing postcodes/zipcodes.

<div id="demo-1">
  The postcode for Anfield is L4 0TH.
</div>

<div id="demo-2">
  The zip code for the Yankee Stadium is 10451.
</div>
$(function () {
  $('#demo-1,#demo-2').mapIt();
});

3. Specify the country. Default: 'uk'.

$(function () {
  $('#demo-1,#demo-2').mapIt({
    country: 'us'
  });
});

4. Determine whether to open the map links in a new tag/window. Default: true.

$(function () {
  $('#demo-1,#demo-2').mapIt({
    newWindow: true
  });
});

5. Customize the alternative text displayed in the tooltip.

$(function () {
  $('#demo-1,#demo-2').mapIt({
    tooltip: ' - Google maps'
  });
});

6. Use Bing Maps instead.

$(function () {
  $('#demo-1,#demo-2').mapIt({
    mapurl:'https://www.bing.com/maps/default.aspx?q=', 
    tooltip:' - Bing maps'
  });
});

This awesome jQuery plugin is developed by gar-cad. For more Advanced Usages, please check the demo page or visit the official website.