Parcourir la source

validation de la recherche de lieu avec la touche enter + positionnement auto du curseur sur le champ de recherche

julpec il y a 8 ans
Parent
commit
81329b871a
1 fichiers modifiés avec 11 ajouts et 1 suppressions
  1. 11 1
      panorama/templates/panorama/main.html

+ 11 - 1
panorama/templates/panorama/main.html

@@ -251,9 +251,19 @@
             map.addLayer(pointsOfInterest);
             map.addLayer(pointsOfInterest);
             map.fitBounds(fittingMarkers,{padding: [30, 30]});
             map.fitBounds(fittingMarkers,{padding: [30, 30]});
             legend.addTo(map);
             legend.addTo(map);
+        }
 
 
-
+        // Submit on enter keypress for the search module
+        $('#search').keypress(function(e){
+            if(e.which == 13) {
+                document.getElementById("search-btn").click();
             }
             }
+        });
+        // Put cursor on the search field for dropdown search module
+        $('#search-menu').click(function () {
+            setTimeout(function(){$('#search').focus();},0);
+        });
+
         initmap();
         initmap();
 
 
         accordionMenus(); 
         accordionMenus();