Skip to content

elcoruco/inegi_facil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;
});

About

statistical and geographical apps from inegifacil.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published