none
help with javascript RRS feed

  • Question

  • Hi,

     

    I have following code to draw points on my map. However, when I hover over the point, the information box appears for few seconds and then goes away. How do I write  javascript so that it behaves like Ajax 6.3 infoBox?

     

    // JScript source code

    function

     

    GetPoints() {

    map.entities.clear();

    $.getJSON(

    '/_vti_bin/listdata.svc/MyList?$select=Id,Field1,Field2,Lat,Long,Status', function

    (data) {

    $.each(data.d.results,

    function

    (i, result) {

     

    if

    (result.Lat && result.Long) {

     

    var site = new

    Microsoft.Maps.Location(result.Lat, result.Long);

     

    var

    siteStatus = result.Status;

     

    var siteShape = new

    Microsoft.Maps.Pushpin(site, { icon: setIcon(siteStatus), height: 16, width: 16 });

     

    var siteInfoBox = new Microsoft.Maps.Infobox(site, { title: result.Field1, visible: false, offset: new

    Microsoft.Maps.Point(0, 5) });

     

     

    //Write a method to show infoBox content

     

    // Add event handlers for hovering over the pushpin

    Microsoft.Maps.Events.addHandler(siteShape,

    'mouseover', function(){siteInfoBox.setOptions({ visible: true

    });});

    Microsoft.Maps.Events.addHandler(siteShape,

    'mouseout', function(){siteInfoBox.setOptions({ visible: false

    });});

     

     

    map.entities.push(siteShape);

    map.entities.push(siteInfoBox);

     

    }

    });

    });

    }

     Please help,

     

     

    • Moved by Ricky_Brundritt Saturday, March 10, 2012 12:46 PM (From:Bing Maps: Map Control and Web services Development)
    Saturday, December 17, 2011 7:00 AM

Answers