Welcome to mapbox-gl-split 👋
Live DEMO
npm install --save mapbox-gl-split
mapbox-gl-split
依赖 mapbox-gl
,需要先引入 mapbox-gl
<div id="container">
<div id="container1"></div>
<div id="container2"></div>
</div>
import { SplitMap } from 'mapbox-gl-split'
const map1 = new mapboxgl.Map({ container: 'container1', style });
const map2 = new mapboxgl.Map({ container: 'container2', style });
new SplitMap('container', {
maps: [map1, map2]
});
<div id="container">
<div id="container1"></div>
<div id="container2"></div>
</div>
<script src="https://unpkg.com/mapbox-gl-split"></script>
<script>
const map1 = new mapboxgl.Map({ container: 'container1', style });
const map2 = new mapboxgl.Map({ container: 'container2', style });
new SplitMap('container', {
maps: [map1, map2]
});
</script>