Skip to content

Commit c43de73

Browse files
authored
Merge pull request #114 from billdevcode/feature-branch
Add esc keydown to close side nav
2 parents 1f4ca12 + 7def241 commit c43de73

File tree

1 file changed

+8
-3
lines changed
  • projects/maps-locations/src

1 file changed

+8
-3
lines changed

projects/maps-locations/src/app.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ $(document).ready(function() {
33
useSideSearch = false, pyrmont, mapZoom = 14,
44
places = {};
55

6-
getGeoLocation();
6+
getGeoLocation();
77

8-
function getGeoLocation() {
8+
function getGeoLocation() {
99
var url = 'https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyAytr024G7F4gULgAW1eMTtExZjaFwJuzE';
1010
$.ajax({
1111
url: url,
@@ -32,7 +32,6 @@ $(document).ready(function() {
3232
bounds: defaultBounds,
3333
};
3434
autocomplete = new google.maps.places.Autocomplete(input, options);
35-
3635
}
3736

3837
$('.main-button, .sidenav-button').on("click", function() {
@@ -135,6 +134,12 @@ $(document).ready(function() {
135134
}
136135
});
137136

137+
$(document).on('keydown', function(e) {
138+
if (e.which == 27 && useSideSearch) {
139+
$("#close-nav").click();
140+
}
141+
})
142+
138143
function slideSideNav() {
139144
var mq = window.matchMedia( "(min-width: 500px)" );
140145
if (mq.matches) {

0 commit comments

Comments
 (0)