Skip to content

Instantly share code, notes, and snippets.

@emilepetrone
Created December 27, 2010 19:58
Show Gist options
  • Save emilepetrone/756484 to your computer and use it in GitHub Desktop.
Save emilepetrone/756484 to your computer and use it in GitHub Desktop.
:javascript
|$(document).ready(function() {
| var client = new simplegeo.ContextClient('XXX');
| function printlocation(err, position) {
| if (err) {
| $("#location").text("Unable to load location: " + err);
| } else {
| var coords = position.coords;
| $("#location").text("Your location is lat: " + coords.latitude + ", lon: " + coords.longitude )
| };
| };
| client.getLocationFromIP( function(err, position) {
| printlocation(err, position);
| $("#location").text("Finding your location");
| client.watchLocationFromBrowser({
| enableHighAccuracy: true
| },
| printlocation);
| });
|});
#maincontainer
#contentwrapper
header
a(href: '/')
h1 Hi From
#location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment