Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're using the event on the base map so I would recommend to bind the event on the pushpin itself to avoid unnecessary call of this specific event.</p> <p>But if you want to update your code, here is a complete example that truly works since the 'hand' is the default element in Bing Maps while the mouse is over the base map, see the code: </p> <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Bing Maps Cursor&lt;/title&gt; &lt;script type="text/javascript" charset="UTF-8" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var map = null; function getMap() { // Initialize the map map = new Microsoft.Maps.Map(document.getElementById('map'), { credentials: "YOURKEY", center: new Microsoft.Maps.Location(47.5, 2.75), zoom: 4, mapTypeId: Microsoft.Maps.MapTypeId.road }); var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(47.5, 2.75)); map.entities.push(pin); Microsoft.Maps.Events.addHandler(map, 'mousemove', function(event) { if(event.targetType === 'pushpin') { map.getRootElement().style.cursor = 'pointer'; } else { map.getRootElement().style.cursor = 'url("' + Microsoft.Maps.Globals.cursorPath + 'grab.cur"), move'; } }); } &lt;/script&gt; &lt;/head&gt; &lt;body onload="getMap();"&gt; &lt;div id="map" style="position: relative; width: 800px; height: 600px;"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And if you want the recommend approach based on the pushpin event: </p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Bing Maps Cursor&lt;/title&gt; &lt;script type="text/javascript" charset="UTF-8" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var map = null; var cursorStyle = null; function getMap() { // Initialize the map map = new Microsoft.Maps.Map(document.getElementById('map'), { credentials: "YOURKEY", center: new Microsoft.Maps.Location(47.5, 2.75), zoom: 4, mapTypeId: Microsoft.Maps.MapTypeId.road }); var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(47.5, 2.75)); map.entities.push(pin); Microsoft.Maps.Events.addHandler(pin, 'mouseover', changeCursor); Microsoft.Maps.Events.addHandler(pin, 'mouseout', revertCursor); } function changeCursor(e) { map.getRootElement().style.cursor = 'pointer'; } function revertCursor(e) { map.getRootElement().style.cursor = 'url("' + Microsoft.Maps.Globals.cursorPath + 'grab.cur"), move'; } &lt;/script&gt; &lt;/head&gt; &lt;body onload="getMap();"&gt; &lt;div id="map" style="position: relative; width: 800px; height: 600px;"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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