none
Custominfo box not working on Chrome and firefox

    Question

  • Hi,

    I have attached a mouse over event and it is working fine in IE 10 but not working in Chrome and firefox.

    Do you have any idea why this is happening?

    Thanks in advance.

    Friday, September 06, 2013 9:49 AM

Answers

  • I experienced a similar problem where the pins/infoboxes work in IE and Chrome but wouldn't appear in Firefox.  In Firefox, the code died at the addhandler line:


      var PinInfo = JSON.parse($(this).val());
     
                var latVal = parseFloat(PinInfo.latitude);
                var longVal = Microsoft.Maps.Location.normalizeLongitude(parseFloat(PinInfo.longitude));
                var location = new Microsoft.Maps.Location(latVal, longVal);
    
                //make pin
                var pin = new Microsoft.Maps.Pushpin(location, { text: PinInfo.label });
                pin.ID = PinInfo.facilityid;
                pin.Title = PinInfo.name;
                pin.Description = PinInfo.info;
                pin.Label = PinInfo.label;
                
    
                //Add a handler for the pushpin/pininfo box event when mouse over and out
                Microsoft.Maps.Events.addHandler(pin, 'mouseover', displayInfoBox);
    
                //Push it
                PinLayer.push(pin);
    ...
    ...
    ...
      function displayInfoBox(e) {
            if (e.targetType == 'pushpin') {
                pinInfoBox.setLocation(e.target.getLocation());
                boxOffset = new Microsoft.Maps.Point(0, 40);
                pinInfoBox.setOptions({ visible: true, title: e.target.Title, description: e.target.Description, offset: boxOffset });
            }

    The problem was the the displayInfoBox appeared after the addhandler.  When I move the function before the make pi code it worked.


    Friday, September 27, 2013 11:23 PM
  • Friday, September 06, 2013 12:34 PM

All replies

  • Friday, September 06, 2013 12:34 PM
  • Hi,

    It is not working for me .

    The mouse over event is not firing in chrome and firefox.

    What should i do? Any other solution.

    Tuesday, September 10, 2013 6:32 AM
  • I experienced a similar problem where the pins/infoboxes work in IE and Chrome but wouldn't appear in Firefox.  In Firefox, the code died at the addhandler line:


      var PinInfo = JSON.parse($(this).val());
     
                var latVal = parseFloat(PinInfo.latitude);
                var longVal = Microsoft.Maps.Location.normalizeLongitude(parseFloat(PinInfo.longitude));
                var location = new Microsoft.Maps.Location(latVal, longVal);
    
                //make pin
                var pin = new Microsoft.Maps.Pushpin(location, { text: PinInfo.label });
                pin.ID = PinInfo.facilityid;
                pin.Title = PinInfo.name;
                pin.Description = PinInfo.info;
                pin.Label = PinInfo.label;
                
    
                //Add a handler for the pushpin/pininfo box event when mouse over and out
                Microsoft.Maps.Events.addHandler(pin, 'mouseover', displayInfoBox);
    
                //Push it
                PinLayer.push(pin);
    ...
    ...
    ...
      function displayInfoBox(e) {
            if (e.targetType == 'pushpin') {
                pinInfoBox.setLocation(e.target.getLocation());
                boxOffset = new Microsoft.Maps.Point(0, 40);
                pinInfoBox.setOptions({ visible: true, title: e.target.Title, description: e.target.Description, offset: boxOffset });
            }

    The problem was the the displayInfoBox appeared after the addhandler.  When I move the function before the make pi code it worked.


    Friday, September 27, 2013 11:23 PM