Created
February 20, 2014 16:41
-
-
Save alexjamesbrown/9118022 to your computer and use it in GitHub Desktop.
Using GeoComplete with RequireJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>RequireJS Async plugin</title> | |
</head> | |
<body> | |
<h1>Geocomplete With RequireJS</h1> | |
<form> | |
<input id="geocomplete" type="text" placeholder="Type in an address" size="90" autocomplete="off"> | |
<input id="find" type="button" value="find"> | |
</form> | |
<div id="map_canvas" style="width: 400px; height: 300px; border: 1px solid #ccc; background-color: #f5f5f5"></div> | |
<script src="./lib/require.js"></script> | |
<script> | |
requirejs.config({ | |
waitSeconds: 120, | |
paths: { | |
async: './lib/async', | |
jquery: './lib/jquery-1.7.2.min', | |
geocomplete: './lib/jquery.geocomplete.min' | |
}, | |
shim: { | |
'geocomplete': ['jquery'], | |
} | |
}); | |
require(['async!http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false', 'jquery', 'geocomplete'], function () { | |
$("#geocomplete").geocomplete({ | |
map: "#map_canvas" | |
}); | |
} | |
); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment