UNPKG

xindoo-leaflet-plugin-trackplayback

Version:
42 lines (36 loc) 1.71 kB
<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>leaflet.trackplayback</title> <link rel="stylesheet" href="examples/lib/leaflet/leaflet.css"> <link rel="stylesheet" href="dist/control.playback.css"> <script src="examples/lib/leaflet/leaflet.js"></script> <script src="dist/control.trackplayback.js"></script> <script src="dist/leaflet.trackplayback.js"></script> </head> <body> <a href="https://github.com/linghuam/Leaflet.TrackPlayBack"><img style="position: absolute; top: 0; left: 0; border: 0;z-index: 999;" src="https://s3.amazonaws.com/github/ribbons/forkme_left_green_007200.png" alt="Fork me on GitHub"></a> <div id='mapid' style=" position: absolute; left: 0; top: 0; right: 0; bottom: 0; width: 100%; height: 100%; overflow: hidden;"></div> <script> const xhr = new XMLHttpRequest(); xhr.open('GET', 'examples/data/test.json', false); xhr.send(null); const data = JSON.parse(xhr.responseText); const map = L.map('mapid').setView([34.36384353883067, 134.09362792968753], 9); L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }).addTo(map); const trackplayback = L.trackplayback(data, map, { targetOptions: { useImg: true, imgUrl: 'examples/ship.png' } }); const trackplaybackControl = L.trackplaybackcontrol(trackplayback); trackplaybackControl.addTo(map); </script> </body> </html>