@@ -73,15 +73,6 @@ html, body {
7373#ribbon-map a:active { text-decoration: none; color: blue; text-shadow: none; transition: text-shadow 0.5s ease 0s;}
7474#ribbon-map a:hover { text-decoration: none; text-shadow: #0090ff 0px 0px 2px;}
7575
76- .show, .hide{
77- -webkit-transition: .4s ease-out;
78- transition: .4s ease-out;
79- }
80-
81- .hide {
82- left: -800px;
83- }
84-
8576#ribbon-map-padding {
8677 display: inline-block ;
8778 vertical-align: top;
@@ -161,14 +152,14 @@ html, body {
161152<div id =" map" ></div >
162153<!-- <div id="content"></div> -->
163154
164- <div id =" ribbon-map" class = " show " >
155+ <div id =" ribbon-map" >
165156<!--
166157 <div id="ribbon-map-padding" onclick="toggle(this)">
167158 <span class="ToolTip">‹</span>
168159 </div>
169160-->
170161
171- <div id =" ribbon-map-toggle" >
162+ <div id =" ribbon-map-toggle" class = " show " >
172163 <div id =" ribbon-map-nav" >
173164 <span class =" osm-home" ></span ><a href =" { $HOME } " >{ $HOME_NAME } </a ><br />
174165 <span class =" osm-left-big" ></span ><a href =" { $HOME_PREV } " >{ $HOME_PREV_NAME } </a >
@@ -209,14 +200,16 @@ html, body {
209200<script type =" text/javascript" >
210201function toggle (arrow )
211202{
212- var el = document.getElementById(' ribbon-map' );
203+ var el = document.getElementById(" ribbon-map-toggle " );
213204 var box = el.getAttribute(" class" );
214205 if (box == " hide" ){
215206 el.setAttribute(" class" , " show" );
216207 $(arrow).children(" .ToolTip" ).html(" ‹" );
208+ el.removeAttribute(" style" );
217209 }
218210 else {
219211 el.setAttribute(" class" , " hide" );
212+ el.setAttribute(" style" ," visibility:hidden;width:0px;" );
220213 $(arrow).children(" .ToolTip" ).html(" ›" );
221214 }
222215}
@@ -431,57 +424,28 @@ function toggle(arrow)
431424 }
432425
433426 function findMyLocation (){
434- /* Does not work on Firefox http://leafletjs.com/examples/mobile-example.html */
427+ /* http://leafletjs.com/examples/mobile-example.html */
435428 /* http://www.bennadel.com/blog/2023-Geocoding-A-User-s-Location-Using-Javascript-s-GeoLocation-API.htm */
436- if (navigator.geolocation) {
437- var locationMarker = null;
438-
439- navigator.geolocation.getCurrentPosition(
440- function( position ){
441-
442- if (locationMarker){
443- return;
444- }
445- //console.log( " Initial Position Found, lat:" + position.coords.latitude + " lon: " + position.coords.longitude);
446-
447- // Add a marker to the map using the position.
448- map.panTo([position.coords.latitude, position.coords.longitude]);
449-
450- } ,
451- function( error ){
452- console.log( " Something went wrong: " , error );
453- } ,
454- {
455- timeout: (5 * 1000),
456- maximumAge: (1000 * 60 * 15),
457- enableHighAccuracy: true
458- }
459- );
460-
461- var positionTimer = navigator.geolocation.watchPosition(
462- function( position ){
463-
464- // Log that a newer, perhaps more accurate position has been found.
465- //console.log( " Newer Position Found, lat:" + position.coords.latitude + " lon: " + position.coords.longitude);
466-
467- // Set the new position of the existing marker.
468- map.panTo([position.coords.latitude, position.coords.longitude]);
469- }
470- );
471-
472- // If the position hasn' t updated within 2 minutes, stop
473- // monitoring the position for changes.
474- setTimeout(
475- function(){
476- // Clear the position watcher.
477- navigator.geolocation.clearWatch( positionTimer );
478- } ,
479- (1000 * 60 * 2)
480- );
481-
482- }
429+ map.locate({ setView: true , maxZoom: 16} );
483430 }
484431
432+ /* BEGIN leaflet Location */
433+ function onLocationFound(e) {
434+ var radius = e.accuracy / 2;
435+
436+ L.marker(e.latlng).addTo(map)
437+ .bindPopup(" You are within " + radius + " meters from this point" ).openPopup();
438+
439+ L.circle(e.latlng, radius).addTo(map);
440+ }
441+
442+ function onLocationError(e) {
443+ alert(e.message);
444+ }
445+
446+ map.on('locationfound', onLocationFound);
447+ map.on('locationerror', onLocationError);
448+
485449{ /literal }
486450</script >
487451<link rel =" stylesheet" href =" http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" >
0 commit comments