Load container on page load

master
Keith Irwin 2017-08-07 10:17:59 -04:00
parent 4e76e12243
commit 10709b1342
No known key found for this signature in database
GPG Key ID: 378933C743E2BBC0
1 changed files with 25 additions and 20 deletions

View File

@ -4,6 +4,18 @@
var pano, newLoc;
const main = document.getElementsByTagName('main')[0];
// Create panorama
function init(){
pano = new googlemaps.StreetViewPanorama(main, {
panControl: false,
zoomControl: false,
addressControl: false,
linksControl: false,
motionTracking: false,
motionTrackingControl: false
});
}
// Get street view imagery
function getStreetViewData(loc,rad,cb) {
// Ensure that the location hasn't changed (or this is the initial setting)
@ -32,20 +44,11 @@ function getStreetViewData(loc,rad,cb) {
}
}
// Update street view image
function updateStreetView(loc){
// Create panorama
if ( typeof pano == 'undefined' ){
$('main').empty();
pano = new googlemaps.StreetViewPanorama(main, {
panControl: false,
zoomControl: false,
addressControl: false,
linksControl: false,
motionTracking: false,
motionTrackingControl: false
});
}
// Wait for panorama
if ( typeof pano != 'undefined' ){
// Set panorama
getStreetViewData(loc, 2, function(data){
@ -57,6 +60,8 @@ function updateStreetView(loc){
});
});
}
}
// Track GPS location