From f68214f419e66cfae98a0620ac8ba8802a62b14c Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sat, 18 Feb 2017 13:24:47 +1030 Subject: [PATCH] Push the success map lower, closer to the map and scroll the user to it on success (Sort of #9) --- index.html | 10 +++++++--- js/site.js | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index e864bd3..26e0b01 100644 --- a/index.html +++ b/index.html @@ -38,7 +38,6 @@

-
@@ -49,8 +48,13 @@

Or use my current location.
-
-
+
+ +
+ + +
+
diff --git a/js/site.js b/js/site.js index 48e066f..11bb86c 100644 --- a/js/site.js +++ b/js/site.js @@ -46,6 +46,8 @@ function zoom_to_point(chosen_place, map, marker) { map.setView(chosen_place, 18, {animate: true}); } $("#use_my_location").click(function (e) { + $("#couldnt-find").hide(); + $("#success").hide(); if ("geolocation" in navigator) { navigator.geolocation.getCurrentPosition(function(position) { var point = { @@ -55,16 +57,21 @@ $("#use_my_location").click(function (e) { zoom_to_point(point, findme_map, findme_marker); - $('#instructions').html(successString); + $('#success').html(successString); + $('#success').show(); + window.scrollTo(0, $('#success').position().top - 10); $('.step-2 a').attr('href', '#details'); + }, function (error) { + $("#couldnt-find").show(); }); } else { - /* geolocation IS NOT available */ + $("#couldnt-find").show(); } }); $("#find").submit(function(e) { e.preventDefault(); $("#couldnt-find").hide(); + $("#success").hide(); var address_to_find = $("#address").val(); if (address_to_find.length === 0) return; var qwarg = { @@ -78,7 +85,9 @@ $("#find").submit(function(e) { if (data.length > 0) { zoom_to_point(data[0], findme_map, findme_marker); - $('#instructions').html(successString); + $('#success').html(successString); + $('#success').show(); + window.scrollTo(0, $('#success').position().top - 10); $('.step-2 a').attr('href', '#details'); } else { $("#couldnt-find").show();