var map1;
var center = "28.5507160000001,77.2689280000001";
var center = center.split(",");
var lat = center[0];var lng=center[1];
var pl;
// Draw Animated Polyline
document.getElementById('checkbox').addEventListener('change', (event) => {
if (event.target.checked) {
// call Animated polyline function
animated_polyline();
}
else {
map1.setZoom(4);
MapmyIndia.remove({map:map1,layer:pl});
map1.setCenter({lat: lat, lng: lng});
}
});
// Map Function
function initMap1() {
var center = {lat: lat, lng: lng};
map1 = new MapmyIndia.Map(document.getElementById('right-menu'),
{
center: center,
zoomControl: true,
location: true,
});
}
// Animated polyline function
function animated_polyline(){
var strokecolor= document.getElementById('strokecolor').value;
var strokeopacity= document.getElementById('strokeopacity').value;
var strokeweight= document.getElementById('strokeweight').value;
var poly_position= document.getElementById('poly_position').value;
var polyline_events= document.getElementById('polyline_events').value;
var linegap= document.getElementById('linegap').value;
var poly_fitbounds= document.getElementById('poly_fitbounds').value;
var poly_popuphtml = document.getElementById('poly_popuphtml').value;
var path_option = document.getElementById('path_option').value;
var speed = document.getElementById('speed').value;
pl = new MapmyIndia.Polyline({
map:map1,
path: eval(poly_position),
animate:{
path:JSON.parse(path_option),
speed:JSON.parse(speed),
},
strokeColor: strokecolor,
strokeOpacity: JSON.parse(strokeopacity),
strokeWeight: JSON.parse(strokeweight),
fitbounds:JSON.parse(poly_fitbounds),
lineGap:JSON.parse(linegap),
fitboundOptions:{padding: 120,duration:1000},
popupHtml:poly_popuphtml,
popupOptions:{offset: {'bottom': [0, -20]}}
});
// Animated Polyline Events
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.