Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenStreetMap on PhoneGap
    primarykey
    data
    text
    <p>I want to use OpenStreetMap on a PhoneGap Application.</p> <p>My Problem is that the click events are not fired on PhoneGap.</p> <p>The code below works in a normal browser:</p> <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;OpenLayers Demo&lt;/title&gt; &lt;style type="text/css"&gt; html, body, #basicMap { width: 100%; height: 100%; margin: 0; } &lt;/style&gt; &lt;script src="http://www.openlayers.org/api/OpenLayers.js"&gt;&lt;/script&gt; &lt;script&gt; function init() { map = new OpenLayers.Map("basicMap"); var mapnik = new OpenLayers.Layer.OSM(); var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984 var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection var position = new OpenLayers.LonLat(7.55785346031189,50.3625329673905).transform( fromProjection, toProjection); var zoom = 18; map.addLayer(mapnik); map.setCenter(position, zoom ); var markers = new OpenLayers.Layer.Markers( "Markers" ); map.addLayer(markers); var marker = new OpenLayers.Marker(position); marker.events.register("click", map , function(e){ alert("click"); }); markers.addMarker(marker); } &lt;/script&gt; &lt;/head&gt; &lt;body onload="init();"&gt; &lt;div id="basicMap"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When this code in PhoneGap to display the map, the map is shown and the marker is displayed. However when I click on the marker nothing happens.</p> <p>Does anyone know why this does not work. I am using the Android Emulator and am using Eclipse to create the PhoneGapApplication.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload