Bing map pan results in click handler being activated RRS feed

  • Question

  • Hi,

    I tried to add a click handler to Bing Map that will activate a Bootstrap 4 modal when the map is clicked. However, the click handler is also activated when I pan the map to change views. How can I activate the <g class="gr_ gr_195 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="195" id="195">modal</g> if, and only if, the event is click?

    This is my create map function:

    function createMap() {
                        //generating map options
                        var mapOptions = {
                            credentials: apiKey,
                            mapTypeId: Microsoft.Maps.MapTypeId.road,
                            zoom: 9
                        //print map
                        map = new Microsoft.Maps.Map("#myMap", mapOptions);
                        Microsoft.Maps.Events.addHandler(map, "click", clickedPoint);

    This is my function I'm calling on click:

    function clickedPoint(point) {
                        //check if map is clicked
                        if (point.targetType == "map") {
                            //get coordinates of clicked area of map
                            var pt = new Microsoft.Maps.Point(point.getX(), point.getY());
                            var locTemp =;
                            var location = [locTemp.latitude, locTemp.longitude];
                            //add attributes to map
                            $("#myMap").attr({"data-toggle": "modal", "data-target":"#clickPinModal"})

    Thanks for the help!


    Wednesday, July 19, 2017 5:20 PM


All replies