Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title></title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
- <style>
- @media only screen and (min-width: 600px) {
- body {
- margin-right: 200px;
- margin-left: 200px;
- margin-top: 20px;
- }
- }
- #map {
- height: 100%;
- }
- html, body {
- height: 100%;
- margin: 0px;
- }
- </style>
- </head>
- <body>
- <div id="map"> </div>
- </body>
- <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
- <script>
- var lat = 26.1635173;
- var lng = -81.5583298;
- var zoom = 15;
- var map = L.map('map').setView([lat,lng], zoom);
- L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
- maxZoom: 19,
- attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
- }).addTo(map);
- var marker = L.marker([lat,lng]).addTo(map);
- setInterval(function(){
- lng += 0.0001;
- let newLatLng = L.latLng(lat,lng);
- marker.setLatLng(newLatLng);
- },100);
- setInterval(function(){
- map.panTo([lat, lng]);
- },5000);
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement