”).addClass(“canvas_map”).css({
width: “100%”,
height: “100%”
}).appendTo(this.map_div), this.oMap = new d.maps.Map(this.canvas_map.get(0), this.o.map_options)
} catch (e) {
this.errors.push(e.toString())
}
a = 0;
for (b in this.o.styles) this.o.styles.hasOwnProperty(b) && (a++, this.oMap.mapTypes.set(“map_style_” + a, new d.maps.StyledMapType(this.o.styles[b], {
name: b
})), this.oMap.setMapTypeId(“map_style_” + a));
this.debug(“01”)
};
c.prototype.add_markers_to_objMap = function () {
var a;
a =
this.o.type || “marker”;
switch (a) {
case “marker”:
for (a = 0; a < this.ln; a++) this.create.marker.call(this, a);
break;
default:
this.create[a].apply(this)
}
};
c.prototype.create = {
marker: function (a) {
var b = this,
e = this.o.locations[a],
c, h, l, m, g = new d.maps.LatLng(e.lat, e.lon),
r = !1 === e.visible ? !1 : !0;
f.extend(e, {
position: g,
map: this.oMap,
zIndex: 1E4,
visible: !1 === this.o.show_markers ? !1 : r
});
e.image && (l = e.image_w || 32, m = e.image_h || 32, f.extend(e, {
icon: new d.maps.MarkerImage(e.image, new d.maps.Size(l, m), new d.maps.Point(0, 0), new d.maps.Point(l /
2, m / 2))
}));
c = new d.maps.Marker(e);
d.maps.event.addListener(c, “click”, function () {
b.o.beforeShow(a, e, c);
h = !1 === e.show_infowindows ? !1 : !0;
b.o.show_infowindows && h && b.open_infowindow(a, c);
b.oMap.panTo(g);
e.zoom && b.oMap.setZoom(e.zoom);
b.current_control && (b.o.generate_controls && b.current_control.activateCurrent) && b.current_control.activateCurrent.call(b, a + 1);
b.current_index = a;
b.o.afterShow(a, e, c)
});
this.oBounds.extend(g);
this.markers.push(c);
this.o.afterCreateMarker(a, e, c);
e.visible = r;
return c
},
polyline: function () {
var a,
b, e =
;
for (a = 0; a < this.ln; a++) b = new d.maps.LatLng(this.o.locations[a].lat, this.o.locations[a].lon), e.push(b), this.create.marker.call(this, a);
f.extend(this.o.stroke_options, {
path: e,
map: this.oMap
});
this.Polyline ? this.Polyline.setOptions(this.o.stroke_options) : this.Polyline = new d.maps.Polyline(this.o.stroke_options)
},
polygon: function () {
var a = this,
b, e, c =
;
for (b = 0; b < this.ln; b++) e = new d.maps.LatLng(this.o.locations[b].lat, this.o.locations[b].lon), c.push(e), this.create.marker.call(this, b);
f.extend(this.o.stroke_options, {
paths: c,
editable: this.o.draggable,
map: this.oMap
});
this.Polygon ? this.Polygon.setOptions(this.o.stroke_options) : this.Polygon = new d.maps.Polygon(this.o.stroke_options);
d.maps.event.addListener(this.Polygon, “click”, function (b) {
a.o.onPolylineClick(b)
})
},
fusion: function () {
f.extend(this.o.fusion_options, {
styles: [this.o.stroke_options],
map: this.oMap
});
this.Fusion ? this.Fusion.setOptions(this.o.fusion_options) : this.Fusion = new d.maps.FusionTablesLayer(this.o.fusion_options)
},
directions: function () {
var a = this,
b, c, k, h, l, m =
,
g = 0;
for (b = 0; b < this.ln; b++) k = new d.maps.LatLng(this.o.locations[b].lat, this.o.locations[b].lon), 0 === b ? h = k : b === this.ln - 1 ? l = k : (c = !0 === this.o.locations[b].stopover ? !0 : !1, m.push({
location: k,
stopover: c
})), this.create.marker.call(this, b);
f.extend(this.o.directions_options, {
origin: h,
destination: l,
waypoints: m
});
this.directionsService || (this.directionsService = new d.maps.DirectionsService);
this.directionsDisplay ? this.directionsDisplay.setOptions({
draggable: this.o.draggable
}) : this.directionsDisplay =
new d.maps.DirectionsRenderer({
draggable: this.o.draggable
});
this.directionsDisplay.setMap(this.oMap);
this.o.directions_panel && (this.o.directions_panel = f(this.o.directions_panel), this.directionsDisplay.setPanel(this.o.directions_panel.get(0)));
this.o.draggable && d.maps.event.addListener(this.directionsDisplay, “directions_changed”, function () {
g = a.compute_distance(a.directionsDisplay.directions);
a.o.afterRoute(g)
});
this.directionsService.route(this.o.directions_options, function (b, c) {
c === d.maps.DirectionsStatus.OK &&
(g = a.compute_distance(b), a.directionsDisplay.setDirections(b));
a.o.afterRoute(g, c, b)
})
}
};
c.prototype.compute_distance = function (a) {
var b = 0,
c = a.routes[0],
d = c.legs.length;
for (a = 0; a < d; a++) b += c.legs[a].distance.value;
return b
};
c.prototype.type_to_open = {
bubble: function (a) {
this.infowindow = new d.maps.InfoWindow({
content: a.html || “”
})
}
};
c.prototype.open_infowindow = function (a, b) {
this.CloseInfoWindow();
var c = this.o.locations[a],
d = c.type || this.o.infowindow_type;
c.html && this.type_to_open[d] && (this.o.beforeOpenInfowindow(a,
c, b), this.type_to_open[d].call(this, c), this.infowindow.open(this.oMap, b), this.o.afterOpenInfowindow(a, c, b))
};
c.prototype.get_html_controls = function () {
return this.controls[this.o.controls_type] && this.controls[this.o.controls_type].getHtml ? (this.current_control = this.controls[this.o.controls_type], this.current_control.getHtml.apply(this)) : “”
};
c.prototype.generate_controls = function () {
if (this.o.controls_on_map) {
var a = f(‘
’).css(this.o.controls_applycss ? {
margin: “5px”
} : {}),
b = f(this.get_html_controls()).css(this.o.controls_applycss ? {
background: “
#fff”,
padding: “5px”,
border: “1px solid rgb(113,123,135)”,
boxShadow: “rgba(0, 0, 0, 0.4) 0px 2px 4px”,
maxHeight: this.map_div.find(“.canvas_map”).outerHeight() - 80,
minWidth: 100,
overflowY: “auto”,
overflowX: “hidden”
} : {});
a.append(b);
this.oMap.controls[this.o.controls_position].push(a.get(0))
} else this.controls_wrapper.empty(), this.controls_wrapper.append(this.get_html_controls())
};
c.prototype.init_map = function () {
var a =
this,
b = 0;
this.Polyline && this.Polyline.setMap(null);
this.Polygon && this.Polygon.setMap(null);
this.Fusion && this.Fusion.setMap(null);
this.directionsDisplay && this.directionsDisplay.setMap(null);
if (this.markers) {
for (b in this.markers)
if (this.markers[b]) try {
this.markers[b].setMap(null)
} catch (c) {
a.errors.push(c)
}
this.markers.length = 0;
this.markers =
}
this.o.controls_on_map && this.oMap.controls && this.oMap.controls[this.o.controls_position].forEach(function (b, c) {
try {
a.oMap.controls[this.o.controls_position].removeAt(c)
} catch (e) {
a.errors.push(e)
}
});
this.oBounds = new d.maps.LatLngBounds;
this.debug(“02”)
};
c.prototype.perform_load = function () {
1 === this.ln ? (this.oMap.setCenter(this.markers[0].getPosition()), this.ViewOnMap(1)) : 0 === this.ln ? (this.o.map_options.set_center ? this.oMap.setCenter(new d.maps.LatLng(this.o.map_options.set_center[0], this.o.map_options.set_center[1])) : this.oMap.fitBounds(this.oBounds), this.oMap.setZoom(this.o.map_options.zoom)) : (this.oMap.fitBounds(this.oBounds), “number” === typeof (this.o.start - 0) && 0 < this.o.start && this.o.start <=
this.ln ? this.ViewOnMap(this.o.start) : this.ViewOnMap(this.view_all_key))
};
c.prototype.debug = function (a) {
this.dev && this.errors.length && console.log(a + “: “, this.errors)
};
c.prototype.AddControl = function (a, b) {
if (!a || !b) return !1;
this.controls[a] = b;
return !0
};
c.prototype.CloseInfoWindow = function () {
this.infowindow && (this.current_index || 0 === this.current_index) && (this.o.beforeCloseInfowindow(this.current_index, this.o.locations[this.current_index]), this.infowindow.close(), this.infowindow = null, this.o.afterCloseInfowindow(this.current_index,
this.o.locations[this.current_index]))
};
c.prototype.ShowOnMenu = function (a) {
if (a === this.view_all_key && this.o.view_all && 1 < this.ln) return !0;
a = parseInt(a, 10);
if (“number” === typeof (a - 0) && 0 <= a && a < this.ln) {
var b = !1 === this.o.locations[a].on_menu ? !1 : !0;
if (!1 !== this.o.locations[a].visible && b) return !0
}
return !1
};
c.prototype.ViewOnMap = function (a) {
if (a === this.view_all_key) this.o.beforeViewAll(), this.current_index = a, 0 < this.o.locations.length && (this.o.generate_controls && this.current_control && this.current_control.activateCurrent) &&
this.current_control.activateCurrent.apply(this, [a]), this.oMap.fitBounds(this.oBounds), this.CloseInfoWindow(), this.o.afterViewAll();
else if (a = parseInt(a, 10), “number” === typeof (a - 0) && 0 < a && a <= this.ln) try {
d.maps.event.trigger(this.markers[a - 1], “click”)
} catch (b) {
this.errors.push(b.toString())
}
this.debug(“03”)
};
c.prototype.SetLocations = function (a, b) {
this.o.locations = a;
b && this.Load()
};
c.prototype.AddLocations = function (a, b) {
var c = this;
f.isArray(a) && f.each(a, function (a, b) {
c.o.locations.push(b)
});
f.isPlainObject(a) &&
this.o.locations.push(a);
b && this.Load()
};
c.prototype.AddLocation = function (a, b, c) {
f.isPlainObject(a) && this.o.locations.splice(b, 0, a);
c && this.Load()
};
c.prototype.RemoveLocations = function (a, b) {
var c = this,
d = 0;
f.isArray(a) ? f.each(a, function (a, b) {
b - d < c.ln && c.o.locations.splice(b - d, 1);
d++
}) : a < this.ln && this.o.locations.splice(a, 1);
b && this.Load()
};
c.prototype.Loaded = function () {
return this.loaded
};
c.prototype._init = function () {
this.ln = this.o.locations.length;
for (var a = 0; a < this.ln; a++) f.extend(this.o.locations[a],
this.o.commons), this.o.locations[a].html && (this.o.locations[a].html = this.o.locations[a].html.replace(”%index”, a + 1), this.o.locations[a].html = this.o.locations[a].html.replace(“%title”, this.o.locations[a].title || “”));
this.map_div = f(this.o.map_div);
this.controls_wrapper = f(this.o.controls_div)
};
c.prototype.Load = function (a) {
f.extend(!0, this.o, a);
a && a.locations && (this.o.locations = a.locations);
this._init();
!1 === this.o.visualRefresh ? d.maps.visualRefresh = !1 : d.maps.visualRefresh = !0;
this.init_map();
this.create_objMap();
this.add_markers_to_objMap();
1 < this.ln && this.o.generate_controls || this.o.force_generate_controls ? (this.o.generate_controls = !0, this.generate_controls()) : this.o.generate_controls = !1;
var b = this;
if (this.loaded) this.perform_load();
else {
d.maps.event.addListenerOnce(this.oMap, “idle”, function () {
b.perform_load()
});
d.maps.event.addListener(this.oMap, “resize”, function () {
b.canvas_map.css({
width: b.map_div.width(),
height: b.map_div.height()
})
});
for (var c in this.o.listeners) {
var k = this.oMap,
h = this.o.listeners[c];
this.o.listeners.hasOwnProperty(c) && d.maps.event.addListener(this.oMap, c, function (e) {
h(k, e)
})
}
}
this.loaded = !0
};
return c
}();
“function” == typeof define && define.amd ? define(function () {
return p
}) : s.Maplace = p
})(jQuery, this, google);
```
>
Code: #contentarea:after{ content:" "; clear:both; display:block; height:0; } #contentarea{padding-bottom:50px}
This bit of code fixed the bottom margin issue. Now I have enough space under the maps in every browser.
> I’m not keen on the fact that you removed my horizontal scrollbar and fiddled with the viewports vertical scrollbar as your fixed positioned element now sits over the controls for the vertical scrollbar. It’s usually best to avoid touching the html and body overflow properties at all.
I followed your advice and eliminated the overflow properties, but it caused some issues. I’m not sure if this is the right place to ask but I have a Jquery bit of code that scrolls down to the bottom of the page automatically. When I eliminated those overflow properties, my function stopped working. Do you know any way around this? This is the code for my script:
$("#html, #body").animate({ scrollTop: this.height() }, "slow"); return false;