statistical and geographical apps from inegifacil.com
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
index.html
jquery.capturegeolocation.js
jquery.js
main.js

README.md

inegi_facil

Capture geolocation

statistical and geographical apps from inegifacil.com

Basic usage

Make a simple callback to capture the geolocation:

var response  = function( geolocation ){
  console.log( geolocation );
};

Call the plugin using any element, passing the callback as an option

$('body').captureGeolocation({callback : response });

Example

var response = function( geolocation ){
  if( geolocation.singlePoint ){
    var g = geolocation.singlePoint,
        e = $('.example1'),
        t = "";

    t += "timestamp: " + g.timestamp + "<br>";
    for(var i in g.coords){
      if( g.coords.hasOwnProperty(i) ){
        t+= i + ": " + g.coords[i] + "<br>";
      }
    }

    e.html( t );
  }
};

$('.example1_btn').on('click', function(){
  $('body').captureGeolocation({ callback : response });
  return false;
});