javascript - Mapbox: map 外部的标记导航链接

标签 javascript navigation mapbox markers

我一直在尝试使用 Mapbox.com 上的示例进行链接导航。 marker nav

我希望能够将 js insideHTML 更改为我自己的 geojson 中的不同属性,即将标题更改为“editorname”。我可以让导航链接反射(reflect)正确的属性,但它会禁用弹出窗口。如果我没有让我的问题变得简洁,我对此真的很陌生。以下是我正在处理的内容。

我的geoJSON:

    myLayer.setGeoJSON([{
    "type":"Feature","geometry":{"type":"Point","coordinates":[-87.453325,38.006909]},"properties":{"objectid_1":2,"objectid":50,"title":"CENTERRA RIDGE SEC 3","editorname":"Ryan Key","lastupdate":"2014-02-03T00:00:00.000Z","description":"T-112","weburl":"http://maps.evansvillegis.com/Apps/Subdivisions/Scans/T/T-112.pdf","created_us":null,"created_da":null,"last_edite":null,"last_edi_1":null,"shape_leng":2407.666236,"orig_fid":49,"point_x":2846145.10825,"point_y":1005002.97882,"cartodb_id":2,"created_at":"2015-05-31T23:02:35Z","updated_at":"2015-05-31T23:18:17Z","price_upper":"false","price_mid":"false","price_lower":"true"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-87.474933,38.000353]},"properties":{"objectid_1":4,"objectid":81,"title":"CWKS UNITED","editorname":"Ryan Key","lastupdate":"2014-01-22T00:00:00.000Z","description":"T-104","weburl":"http://maps.evansvillegis.com/Apps/Subdivisions/Scans/T/T-104.pdf","created_us":null,"created_da":null,"last_edite":null,"last_edi_1":null,"shape_leng":1800.536856,"orig_fid":80,"point_x":2839909.17485,"point_y":1002641.02521,"cartodb_id":4,"created_at":"2015-05-31T23:02:35Z","updated_at":"2015-05-31T23:19:22Z","price_upper":"false","price_mid":"false","price_lower":"true"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[-87.634783,38.071915]},"properties":{"objectid_1":5,"objectid":123,"title":"GILMORE HUSSMANN","editorname":"Ryan Key","lastupdate":"2014-04-02T00:00:00.000Z","description":"T-120","weburl":"http://maps.evansvillegis.com/Apps/Subdivisions/Scans/T/T-120.pdf","created_us":null,"created_da":null,"last_edite":null,"last_edi_1":null,"shape_leng":2057.178751,"orig_fid":122,"point_x":2794002.17808,"point_y":1028934.09894,"cartodb_id":5,"created_at":"2015-05-31T23:02:35Z","updated_at":"2015-05-31T23:19:26Z","price_upper":"false","price_mid":"false","price_lower":"true"
    }
}
]);

最佳答案

Here it is 。您所要做的就是:

var content = '<h2>New Content!<\/h2>' +
'<p>' + marker.feature.properties.title + '<br \/>' +
'link: ' + marker.feature.properties.weburl + '<\/p>';

marker.bindPopup(content);

关于javascript - Mapbox: map 外部的标记导航链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30718017/

相关文章:

xamarin - 在 Xamarin Forms Shell 中向 GoToAsync URI 导航添加查询会导致其停止工作

css - mapbox Logo 在 Wordpress 中散布在网格之外

javascript - Angular 2在服务中操作数据不会改变第二个组件中的数据

javascript - react : Update nested state?

java - 内置抽屉导航 Activity (点击事件)

iphone - 导航栏上有超过 1 个 rightBarButtonItem

MapBox 标记在缩放时移动

javascript - 将拖动事件从 div 传递到 mapbox 层

javascript - 你如何防止 JS 运动的水平干扰?

javascript - 如何使用 PHP 将数据保存在我的数据库中