Skip to content

Instantly share code, notes, and snippets.

@tcannonfodder
Created September 9, 2015 21:32
Show Gist options
  • Select an option

  • Save tcannonfodder/8de0fa0f4bab557e87b1 to your computer and use it in GitHub Desktop.

Select an option

Save tcannonfodder/8de0fa0f4bab557e87b1 to your computer and use it in GitHub Desktop.
Fix for KSA
<!DOCTYPE html>
<!-- code/comments not formatted for word wrap -->
<html>
<head>
<!-- Display the KSA favicon -->
<link rel="shortcut icon" href="/images/KSA/favicon.ico" type="image/x-icon" />
<title>KSA Flight Tracker</title>
<!-- use this image link to force reddit to use a certain image for its thumbnail -->
<meta property="og:image" content="http://i.imgur.com/2IH1UpQ.png" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<!-- ensure proper scale of page -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS stylesheets -->
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:900" />
<link rel="stylesheet" type="text/css" href="http://static.kerbalmaps.com/leaflet.css" />
<!-- JS libraries -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="leaflet.js"></script>
<script type="text/javascript" src="leafletembed.js"></script>
</head>
<body style="padding: 0; margin: 0;">
<div id='map' class='map' style='padding: 0; margin: 0; height: 548px; width: 1044px;'></div>
<script>
// create the map with some custom options
// details on Leaflet API can be found here - http://leafletjs.com/reference.html
document.addEventListener("DOMContentLoaded", function(event) {
var map = new L.KSP.Map('map', {
layers: [L.KSP.CelestialBody.KERBIN],
center: [0,0],
bodyControl: false,
layersControl: false,
scaleControl: true,
});
map.fitWorld()
})
</script>
</body>
</html>
@Gaiiden

Gaiiden commented Sep 10, 2015

Copy link
Copy Markdown

Thanks!! Turns out it is just the map.fitWorld() that was needed (how does it let me get away without needing a ; after that function call? cause it's the last thing in the script?)

I'm not sure why this method call is required - I do nothing of the sort in the craft.asp file that uses the Leaflet map to show my vessel positions and that one shows up just fine. I tried re-sizing the initial window in which the map was displayed to see if that made a difference and I still needed to call that function to get it to show up. If you have any thoughts on this I'd be happy to hear them. Otherwise, thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment