]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/search.js
Don't autofocus search, fade out "Where am I?" on focus
[rails.git] / app / assets / javascripts / index / search.js
index ce00fa0afff8c74600f757be2732e80288936253..c546469db941a258ee72694481872f546d30b028 100644 (file)
@@ -6,11 +6,13 @@ function initializeSearch(map) {
     $("#search_form").submit();
   }
 
-  // Focus the search field for browsers that don't support
-  // the HTML5 'autofocus' attribute
-  if (!("autofocus" in document.createElement("input"))) {
-    $("#query").focus();
-  }
+  $("#query")
+    .on("focus", function() {
+      $("#describe_location").fadeOut(100);
+    })
+    .on("blur", function() {
+      $("#describe_location").fadeIn(100);
+    });
 
   $("#sidebar_content").on("click", ".search_results_entry a.set_position", clickSearchResult);