0

Happy labour day!

Situation:

I want popups which contain hyperlinked text. I would like to show the popup on mouseover and let the user mouseover the popup to click on the link.

I found a fix from a while back (for Leaflet 0.5.1) seems to fulfill my functionality requirements: http://jsfiddle.net/sowelie/3JbNY/

Problem:

I cannot get it to work nicely on Leaflet 1.0.3. of which I made a jsfiddle: https://jsfiddle.net/68uo7e9m/. It frustratingly works sometimes after repeated hovering from marker to popup (like shown in the gif below).

Questions:

1. Does anyone know what I am doing wrong or why this is not working like in the first jsfiddle?

2. Does anyone have a suggestion how to go about this differently?

My main javascript code is below followed with the data also in javascript even further below.

Main js code

var MyCustomMarker = L.Marker.extend({

    bindPopup: function(htmlContent, options) {

        if (options && options.showOnMouseOver) {

            // call the super method
            L.Marker.prototype.bindPopup.apply(this, [htmlContent, options]);

            // unbind the click event
            this.off("click", this.openPopup, this);

            // bind to mouse over
            this.on("mouseover", function(e) {

                // get the element that the mouse hovered onto
                var target = e.originalEvent.fromElement || e.originalEvent.relatedTarget;
                var parent = this._getParent(target, "leaflet-popup");

                // check to see if the element is a popup, and if it is this marker's popup
                if (parent == this._popup._container)
                    return true;

                // show the popup
                this.openPopup();

            }, this);

            // and mouse out
            this.on("mouseout", function(e) {

                // get the element that the mouse hovered onto
                var target = e.originalEvent.toElement || e.originalEvent.relatedTarget;

                // check to see if the element is a popup
                if (this._getParent(target, "leaflet-popup")) {

                    L.DomEvent.on(this._popup._container, "mouseout", this._popupMouseOut, this);
                    return true;

                }

                // hide the popup
                this.closePopup();

            }, this);

        }

    },

    _popupMouseOut: function(e) {

        // detach the event
        L.DomEvent.off(this._popup, "mouseout", this._popupMouseOut, this);

        // get the element that the mouse hovered onto
        var target = e.toElement || e.relatedTarget;

        // check to see if the element is a popup
        if (this._getParent(target, "leaflet-popup"))
            return true;

        // check to see if the marker was hovered back onto
        if (target == this._icon)
            return true;

        // hide the popup
        this.closePopup();

    },

    _getParent: function(element, className) {

        var parent = element.parentNode;

        while (parent != null) {

            if (parent.className && L.DomUtil.hasClass(parent, className))
                return parent;

            parent = parent.parentNode;

        }

        return false;

    }

});

var mapBox = L.tileLayer('https://api.mapbox.com/styles/v1/fstricker/cj24lz1ez008y2sl5tatjs321/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoiZnN0cmlja2VyIiwiYSI6ImNpbjBuaWpsczAwcGV3MW0yeWZ3bTVzcmgifQ.Xd1cmYQbdHtpBDVPPp7lAg', {
    attribution: 'Map data &copy; <a href="http://http://carnegieendowment.org/">Carnegie</a>, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>'
});

var mymap = L.map('mapid', {
    layers: [mapBox],
    maxBounds: [[73.899900, -26.814528], [12.846228, 143.266096]],
    // maxZoom: 4,
    minZoom: 3,
    // setMaxZoom: 4,
    dragging: true,
    touchZoom: false,
    zoomControl: true,
    scrollWheelZoom: true,
    doubleClickZoom: true,
    // zoomSnap: 0.1,
}).setView([50.650825, 50.276627], 4);

//Better markers
var markers = new L.FeatureGroup();

projects.forEach(function(populate) {
    var marker = new MyCustomMarker(populate.latlng);
    marker.bindPopup(populate.properties.Name,{
        showOnMouseOver: true  
    });
    markers.addLayer(marker);
});
mymap.addLayer(markers);

Data js code

    var projects = [
  {
    region: "Albania",
    home: "Tirana",
    onlyinvested: 1,
    rail: 0,
    solelyEurope: 0,
    latlng: [41.414742, 19.720561],
    single_destination: 1,
    destination: "Beijing",
    destination_location: [116.383333, 39.916667],
    mid_destination: [38.2543245, 51.3236467],
    grandeur: "point",
    check: false,
    type: "Feature",
    // properties: {"Name": "<h4 style='color:red';>Tirana, Albania - October 2016</h4><div id='centralize' class='col-me-1 col-sm-2 col-xs-3'><span class='flag-icon flag-icon-al'></span></div><br>State-backed Chinese firm China Everbright Group <a href='http://www.reuters.com/article/us-china-albania-everbright-idUSKCN1271ZE' target='_blank'>bought all of the shares</a> of Tirana International Airport for an undisclosed amount."
    // },
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-al'></span>Tirana, Albania - October 2016</h4><br>State-backed Chinese firm China Everbright Group <a href='http://www.reuters.com/article/us-china-albania-everbright-idUSKCN1271ZE' target='_blank'>bought all of the shares</a> of Tirana International Airport for an undisclosed amount."
    },
    geometry: {"type": "Point", "coordinates": [19.720561, 41.414742]
    }
  },
  {
    region: "Bulgaria",
    home: "Burgas",
    onlyinvested: 0,
    rail: 0,
    solelyEurope: 0,
    latlng: [42.511065, 27.461233],
    single_destination: 1,
    destination: "Hangzhou",
    destination_location: [120.166667, 30.25],
    mid_destination: [41.498316,73.0666183],
    grandeur: "point",
    check: false,
    type: "Feature",
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-bg'></span>Burgas, Bulgaria - January 2017</h4><br>Chinese company Alibaba is considering building <a href='http://www.globalconstructionreview.com/news/chinese-investors-mull-tw7o-am7bitious-logi7stics/' target='_blank'>a logistical base</a> nearby the Bulgarian coastal city of Burgas. Discussions with the <a href='http://www.reuters.com/article/us-bulgaria-economy-alibaba-idUSKBN14V226' target='_blank'>Bulgarian government</a> are being carried out."
    },
    geometry: {"type": "Point", "coordinates": [27.461233, 42.511065]
    }
  },
  {
    region: "Bulgaria",
    home: "Sofia",
    onlyinvested: 0,
    rail: 0,
    solelyEurope: 1,
    latlng: [42.7, 23.33],
    single_destination: 0,
    destination: "No counterpart defined, just reads: Bulgaria established the national Belt and Road association",
    destination_location: [],
    grandeur: "point",
    check: false,
    type: "Feature",
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-bg'></span>Sofia, Bulgaria - April 2017</h4><br>Bulgaria established the national Belt and Road association."
    },
    geometry: {"type": "Point", "coordinates": [23.33, 42.7]
    }
  },
  {
    region: "Czech Republic",
    home: "Prague",
    onlyinvested: 0,
    rail: 0,
    solelyEurope: 1,
    latlng: [50.083333, 14.416667],
    single_destination: 0,
    destination: "Opening of the New Silk Road Institute in Prague (NSRIP) with the aim of studying and spreading awareness of the Belt and Road Initiative (BRI) to foster Euro-Asia and Euro-China ties. Former Czech Foreign Minister Jan Kohout is chairman of NSRIP and its advisory board includes former Prime Minister Petr Nečas.",
    destination_location: [],
    grandeur: "point",
    check: false,
    type: "Feature",
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-cz'></span>Prague, Czech Republic - September 2015</h4><br>Opening of the New Silk Road Institute in Prague (NSRIP) with the aim of studying and spreading awareness of the Belt and Road Initiative (BRI) to foster Euro-Asia and Euro-China ties. Former Czech Foreign Minister Jan Kohout is chairman of NSRIP and its advisory board includes former Prime Minister Petr Nečas."
    },
    geometry: {"type": "Point", "coordinates": [14.416667, 50.083333]
    }
  },
  {
    region: "Czech Republic",
    home: "Elbe river",
    onlyinvested: 1,
    rail: 0,
    solelyEurope: 0,
    latlng: [50.806984, 14.233406],
    single_destination: 0,
    destination: "Construct the Danube-Oder-Elbe Canal that would link the Black, Baltic, and North Seas and their main river ports in Hamburg, Szczecin, and Constanta. ",
    destination_location: [],
    grandeur: "point", //http://bankwatch.org/documents/letak_DOL_EN.pdf
    check: false,
    type: "Feature",
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-cz'></span>Elbe river, Czech Republic - Unknown ETA</h4><br>Construct the Danube-Oder-Elbe Canal that would link the Black, Baltic, and North Seas and their main river ports in Hamburg, Szczecin, and Constanta. The Czech Republic and China are expected to invest <a href='http://www.scmp.com/news/china/diplomacy-defence/article/1930953/xi-jinpings-visit-czech-republic-raises-hopes-european' target='_blank'>about $1 billion</a>."
    },
    geometry: {"type": "Point", "coordinates": [14.233406, 50.806984]
    }
  },
  {
    region: "France",
    home: "Toulouse",
    onlyinvested: 1,
    rail: 0,
    solelyEurope: 0,
    latlng: [43.6045, 1.444],
    single_destination: 1,
    destination: "Shandong",
    destination_location: [117.124046, 36.653958],
    mid_destination: [45.6783217,59.8537743],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-fr'></span>Toulouse, France - December 2014</h4></div><br>A Chinese-led consortium bought a 49.9 percent stake in the Toulouse Blagnac Airport in southwest France. (<i>See attached EU report. Falls under OBOR but France has not put that label on it.</i>)"
    },
    geometry: {"type": "Point", "coordinates": [1.444, 43.6045]
    }
  },
  {
    region: "France",
    home: "Marseille",
    onlyinvested: 1,
    rail: 0,
    solelyEurope: 0,
    latlng: [43.2964, 5.37],
    single_destination: 1,
    destination: "Beijing",
    destination_location: [116.383333, 39.916667],
    mid_destination: [46.821678, 61.121423],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-fr'></span>Marseille, France - December 2014</h4><br>June 2015 – French shipping company CMA CGM <a href='https://www.cma-cgm.com/news/876/the-cma-cgm-group-to-sign-two-major-economic-agreements-during-the-chinese-prime-minister-s-visit-at-its-headquarter-on-july-1st' target='_blank'>signed a $1 billion</a> financing agreement with the Export-Import Bank of China to purchase Chinese container ships."
    },
    geometry: {"type": "Point", "coordinates": [5.37, 43.2964]
    }
  },
  {
    region: "Germany",
    home: "Leipzig",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [51.333333, 12.383333],
    single_destination: 1,
    destination: "Shenyang",
    destination_location: [122.3228821, 41.5968626],
    mid_destination: [51.436995, 68.793025],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-de'></span>Leipzig, Germany - September 2011</h4><br>Railway linking Leipzig and Shenyang launched (<i>Rebranded as OBOR after 2012</i>)."
    },
    geometry: {"type": "Point", "coordinates": [12.383333, 51.333333] 
    }
  },
  {
    region: "Germany",
    home: "Duisburg",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [51.435147, 6.762692], 
    single_destination: 1,
    destination: "Chongqing",
    destination_location: [106.4084684, 29.5551377],
    mid_destination: [46.339253, 56.501962],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-de'></span>Duisburg, Germany - January 2012</h4><br>The 11,300-kilometer railway linking Duisburg and Chongqing launched (<i>Branded part of OBOR during Xi’s 2014 visit</i>)."
    },
    geometry: {"type": "Point", "coordinates": [6.762692, 51.435147] 
    }
  },
  {
    region: "Germany",
    home: "Hamburg",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [53.565278, 10.001389],
    single_destination: 1,
    destination: "Zhengzhou",
    destination_location: [113.4269663, 34.7075433],
    mid_destination: [49.638635, 61.500044],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-de'></span>Hamburg, Germany - July 2013</h4><br>Trans Eurasia Express connecting Hamburg and Zhengzhou launched."
    },
    geometry: {"type": "Point", "coordinates": [10.001389, 53.565278] 
    }
  },
  {
    region: "Germany",
    home: "Hamburg",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [53.565278, 10.001389],
    single_destination: 1,
    destination: "Harbin",
    destination_location: [126.5119379, 45.7573839],
    mid_destination: [54.391646, 68.888910],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-de'></span>Hamburg, Germany - June 2015</h4><br>Railway linking Hamburg to Harbin launched."
    },
    geometry: {"type": "Point", "coordinates": [10.001389, 53.565278] 
    }
  },
  {
    region: "Germany",
    home: "Nurnberg",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [49.45, 11.083333],
    single_destination: 1,
    destination: "Chengdu",
    destination_location: [103.9354611, 30.6587488],
    mid_destination: [45.337839, 57.211844],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-de'></span>Nurnberg, Germany - October 2015</h4><br>Railway linking Nurnberg and Chengdu launched (<i>Labeled as part of OBOR by both Chinese and German media</i>)."
    },
    geometry: {"type": "Point", "coordinates": [11.083333, 49.45] 
    }
  },
  {
    region: "Germany",
    home: "Berlin",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [52.507222, 13.145833],
    single_destination: 1,
    destination: "Beijing",
    destination_location: [116.383333, 39.916667],
    mid_destination: [50.850264, 66.059732],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-de'></span>Berlin, Germany - March 2016</h4><br>China expands its Eurasian Land Bridge connecting the far East with European ports with deals with cities in France and Germany, including Lyon and Hamburg."
    },
    geometry: {"type": "Point", "coordinates": [13.145833, 52.507222] 
    }
  },
  {
    region: "Greece",
    home: "Piraeus",
    onlyinvested: 1,
    rail: 0,
    solelyEurope: 0,
    latlng: [37.941944, 23.636111],
    single_destination: 1,
    destination: "Beijing",
    destination_location: [116.383333, 39.916667],
    mid_destination: [43.416617, 70.003127],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-gr'></span>Piraeus, Greece - August 2016</h4><br>The China Ocean Shipping Company (COSCO) acquired a majority stake in the Port of Piraeus COSCO’s acquisition of majority stake in the Port of Piraeus. COSCO paid €280.5 million for 51 percent of the shares and €88 million for another 16 percent after five years, on the condition that it invests another €350 million over the next decade."
    },
    geometry: {"type": "Point", "coordinates": [23.636111, 37.941944] 
    }
  },
  {
    region: "Greece",
    home: "Thessaloniki",
    onlyinvested: 1,
    rail: 0,
    solelyEurope: 0,
    latlng: [40.636, 22.922],
    single_destination: 1,
    destination: "Shanghai",
    destination_location: [121.1965635, 31.2246325],
    mid_destination: [40.945101, 72.957231],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-gr'></span>Thessaloniki, Greece - Ongoing</h4><br>The Shanghai Ports International Group has <a href='http://www.hfw.com/HFW-advises-ICTSI-on-Thessaloniki-port-privatisation' target='_blank'>put in a bid</a> to gain a 67 percent stake in the Thessaloniki Port Authority in northern Greece."
    },
    geometry: {"type": "Point", "coordinates": [22.922, 40.636] 
    }
  },
  {
    region: "Hungary",
    home: "Budapest",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [47.4925, 19.051389],
    single_destination: 0,
    destination: "Construction starts on the Budapest Belgrade Railway that will connect the Port of Piraeus in Greece to Budapest via high-speed train. A consortium comprising of the China Railway Group, China Railway Corporation, and the Hungarian State Railways was awarded a €1.5 billion contract to refurbish the 100 mile-long Hungarian section.",
    destination_location: [],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-hu'></span>Budapest, Hungary - September 2016</h4><br>Construction starts on the Budapest Belgrade Railway that will connect the Port of Piraeus in Greece to Budapest via high-speed train. A consortium comprising of the China Railway Group, China Railway Corporation, and the Hungarian State Railways was awarded a €1.5 billion contract to refurbish the 100 mile-long Hungarian section."
    },
    geometry: {"type": "Point", "coordinates": [19.051389, 47.4925] 
    }
  },
  {
    region: "Hungary",
    home: "Budapest",
    onlyinvested: 0,
    rail: 0,
    solelyEurope: 0,
    latlng: [47.4925, 19.051389],
    single_destination: 1,
    destination: "Beijing",
    destination_location: [116.383333, 39.916667],
    mid_destination: [48.035379, 68.487617],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-hu'></span>Budapest, Hungary - March 2016</h4><br>The China National Tourism Administration <a href='http://en.cnta.gov.cn/focus/travelnews/201603/t20160307_762631.shtml' target='_blank'> opened its first office</a> in Central and Eastern Europe in Budapest with the advertising campaign, “Beautiful China, Silk Road”."
    },
    geometry: {"type": "Point", "coordinates": [19.051389, 47.4925] 
    }
  },
  {
    region: "Italy",
    home: "Venice",
    onlyinvested: 0,
    rail: 0,
    solelyEurope: 0,
    latlng: [45.4375, 12.335833],
    single_destination: 0,
    destination: "China and Italy launch the “Five Ports Alliance” project, which aims to create a major container terminal in the region, including Venice, Trieste, and Ravenna in Italy, Capodistria in Slovenia, and Fiume in Croatia.",
    destination_location: [],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-it'></span>Venice, Italy - July 2015</h4><br>China and Italy launch the “Five Ports Alliance” project, which aims to create a major container terminal in the region, including Venice, Trieste, and Ravenna in Italy, Capodistria in Slovenia, and Fiume in Croatia. The project will cost around €2.2 billion in total."
    },
    geometry: {"type": "Point", "coordinates": [12.335833, 45.4375] 
    }
  },
  {
    region: "Netherlands",
    home: "Rotterdam",
    onlyinvested: 1,
    rail: 0,
    solelyEurope: 0,
    latlng: [51.916667, 4.5],
    single_destination: 1,
    destination: "Beijing",
    destination_location: [116.383333, 39.916667],
    mid_destination: [51.319974, 59.460806],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-nl'></span>Rotterdam, Netherlands - May 2016</h4><br>COSCO purchased a 35 percent stake in Euromax, the operator of Europe’s largest port in Rotterdam, in a transaction that totaled <a href='http://worldmaritimenews.com/archives/191588/cosco-pacific-buys-stake-in-euromax-terminal-in-rotterdam/' target='_blank'>€125.43 million</a>."
    },
    geometry: {"type": "Point", "coordinates": [4.5, 51.916667] 
    }
  },
  {
    region: "Netherlands",
    home: "Tilburg",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [51.55, 5.083333],
    single_destination: 1,
    destination: "Chengdu",
    destination_location: [103.9354611, 30.6587488],
    mid_destination: [46.743658, 54.452098],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-nl'></span>Tilburg, Netherlands - April 2016</h4><br>The Chengdu-Tilburg weekly freight train was launched. In September 2016, the port of Rotterdam was added to the scheme, leading to the creation of the <a href='https://www.portofrotterdam.com/en/news-and-press-releases/first-rail-service-china-netherlands-launched' target='_blank'>Chengdu-Tilburg-Rotterdam Express</a>, which is part of the Chengdu–Europe Express Railway Service."
    },
    geometry: {"type": "Point", "coordinates": [5.083333, 51.55] 
    }
  },
  {
    region: "Netherlands",
    home: "Venlo",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [40.649167, 21.385556],
    single_destination: 1,
    destination: "Chongqing",
    destination_location: [106.4084684, 29.5551377],
    mid_destination: [46.348419, 56.494231],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-nl'></span>Venlo, Netherlands - July 2016</h4><br><a href='http://www.newsilkwaylogistics.com/' target='_blank'>New Silkway Logistics (NSWL)</a> was founded, a Verno-based joint venture providing end-to-end intermodal rail and logistics solutions between Europe and China via the Duisburg–Chongqing rail line."
    },
    geometry: {"type": "Point", "coordinates": [21.385556, 40.649167]
    }
  },
  {
    region: "Poland",
    home: "Lodz",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [51.783333, 19.466667],
    single_destination: 0,
    destination: "The Lodz–Chengdu cargo rail connection was officially launched. (This predates the official launch of the Belt and Road Initiative, but was later branded as a key BRI project) In August 2015, the Lodz–Chengdu line was extended to the Haicang Port Area of Xiamen Free Trade Zone. The 10,000-kilometer one-way journey from Xiamen to Lodz takes 15 days.",
    destination_location: [],
    mid_destination: [46.227884, 61.748423],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-pl'></span>Lodz, Poland - April 2013</h4><br>The Lodz–Chengdu cargo rail connection was officially launched. (<i>This predates the official launch of the Belt and Road Initiative, but was later branded as a key BRI project</i>) In August 2015, the Lodz–Chengdu line was <a href='http://www.whatsonxiamen.com/news39485.html' target='_blank'>extended to the Haicang Port Area of Xiamen Free Trade Zone</a>. The 10,000-kilometer one-way journey from Xiamen to Lodz takes 15 days."
    },
    geometry: {"type": "Point", "coordinates": [19.466667, 51.783333]
    }
  },
  {
    region: "Poland",
    home: "Warsaw",
    onlyinvested: 0,
    rail: 1,
    solelyEurope: 0,
    latlng: [52.233333, 21.016667],
    single_destination: 1,
    destination: "Suzhou",
    destination_location: [120.6, 31.3],
    mid_destination: [47.400053, 70.772692],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-pl'></span>Warsaw, Poland - September 2013</h4><br>The Warsaw–Suzhou cargo railway line became functional. The first cargo operator on this line was <a href='http://rzdlog.com/press/187/' target='_blank'>Far East Land Bridge</a>, a joint venture of Russian Railways Logistics. (<i>The timing of this coincides with the launch of BRI, so the project predates the Initiative itself, but is presented as part of the initiative</i>)"
    },
    geometry: {"type": "Point", "coordinates": [21.016667, 52.233333]
    }
  },
  {
    region: "Poland",
    home: "Gdansk",
    onlyinvested: 0,
    rail: 0,
    solelyEurope: 0,
    latlng: [54.366667, 18.633333],
    single_destination: 1,
    destination: "Shanghai",
    destination_location: [121.1965635, 31.2246325],
    mid_destination: [48.799651, 69.897838],
    grandeur: "point",
    check: false,
        type: "Feature", 
    properties: {"Name": "<h4 style='color:red';><span class='flag-icon flag-icon-pl'></span>Gdansk, Poland - March 2009</h4><br>The Port of Gdansk and the Port of Shanghai An signed an <a href='https://www.portgdansk.pl/events/shanghai-gdansk-cooperation' target='_blank'>agreement</a> to promote collaboration between the two parties. The agreement called for cooperation on port management strategy, fostering technological and commercial exchange, and improving efficiency. (<i>presented within the framework of China-Poland maritime relations under BRI</i>)"
    },
    geometry: {"type": "Point", "coordinates": [18.633333, 54.366667]
    }
  }

];
1

One possible fix would be to remove this.closePopup(); from this.on("mouseout", function(e)

While this slightly changes the behaviour (popups stay open until you hover over another popup, close them manually, or press the left mouse button somewhere else) it seems like an easy fix that lets the user click the hyperlinks.

JSFiddle: https://jsfiddle.net/eL8bvre7/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.