相信大家不管是在日常工作,还是制作自己的博客,都希望有炫酷且能准确get到使用者的页面,大家可以参考以下代码:
config.js:
var config = {
style: 'mapbox://styles/branigan/cjzsvonse027m1co4nkxp13b3',
accessToken: 'pk.eyJ1IjoibWJ4c29sdXRpb25zIiwiYSI6ImNrMm01aG9hdTBlZGwzbXQ1ZXVrNHNmejAifQ.QHQA0N6XPWddCXtvoODHZg',
showMarkers: false,
theme: 'light',
title: '',
subtitle: '',
byline: '',
footer: '',
chapters: [
{
id: 'phl',
alignment: 'right',
title: 'Philadelphia Bicycle Infrastructure',
image: '',
description: 'Getting around Philadelphia on two wheels is fast, fun, and cheap. As a typical East Coast large city, the urban core is dense, so there is a lot within reach of a 15 minute ride... even mountain bike trails. Paired with the public transit infrastructure, cycling can be more efficient and much less expensive than driving (and parking) a car.',
location: {
center: [-75.13080, 39.97790],
zoom: 9.83,
pitch: 0.00,
bearing: 0.00
},
onChapterEnter: [
{
layer: 'phl-city-limits',
opacity: .45
}
],
onChapterExit: [
{
layer: 'phl-city-limits',
opacity: 0
}
]
},
{
id: 'bike-lanes',
alignment: 'right',
title: 'Bike Lanes',
image: '',
description: 'Philadelphia has XX miles of bike lanes, XX miles of which are protected. Drivers are getting more used to sharing the road, but ride defensively.',
location: {
center: [-75.13901, 39.97085],
zoom: 11.62,
pitch: 55.50,
bearing: -7.20
},
onChapterEnter: [
{
layer: 'phl-bike-network',
opacity: 1
}
],
onChapterExit: []
},
{
id: 'indego',
alignment: 'right',
title: 'Indego Bike Share',
image: '',
description: 'Indego has been operating in Philadelphia since 20XX. The system initally was focused on Center City, but has expanded service to neighboring areas to support equitable mobility options to the city\'s residents.',
location: {
center: [-75.16468, 39.94503],
zoom: 13.15,
pitch: 60.00,
bearing: -16.80
},
onChapterEnter: [
{
layer: 'indego-stations',
opacity: 0.8
}
],
onChapterExit: [
{
layer: 'indego-stations',
opacity: 0
}
]
},
{
id: 'belmont',

这个博客展示了如何利用Mapbox的GL JS库创建一个交互式地图故事。通过配置JavaScript和HTML,你可以实现地图上的标记、章节切换、动画过渡等功能,用于展示地理信息和城市设施,例如自行车基础设施、公交系统和公园路径。
最低0.47元/天 解锁文章
1811

被折叠的 条评论
为什么被折叠?



