J-BusinessDirectory - Map is not showing up

Support Forum

 
 

 

Hi,


When I try to browse the map by klicking on den small map for a company, the map will not show up.


The only thing that happends is that the button "Toggle street view" shows up ans not the map.


What did I do wrong?

2 replies

Hi Thomaz, 


The behaviour you're experiencing might be related to a javascript conflict. Please open a ticket with our store and send us your Joomla login. 

This is how the script is looking like.

 

 


var panorama;
function initialize() {
var mapOptions = {
zoom: 6,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var mapdiv = document.getElementById("company-map");
mapdiv.style.width = '100%';
mapdiv.style.height = '450px';
var map = new google.maps.Map(mapdiv, mapOptions);
setMarkers(map, locations);
var company = locations[0];
var myLatLng = new google.maps.LatLng(company[0], company[1]);
panorama = map.getStreetView();
panorama.setPosition(myLatLng);
panorama.setPov(/** @type {google.maps.StreetViewPov} */({
heading: 265,
pitch: 0
}));
}
/**
* Data for the markers consisting of a name, a LatLng and a zIndex for
* the order in which these markers should display on top of each
* other.
*/
var locations = [
['59.635586813994834', '17.078006844967604','0','<div class="info-box">
<div class="title">DEMO</div>
<div class="info-box-content">
<div class="address" itemtype="http://schema.org/PostalAddress" itemscope="" itemprop="address">Gulmåragatan 1, 745 63 Enköping</div>
<div class="info-phone">
<i class="dir-icon-phone">
</i> 0723345300</div>
</div>
<div class="info-box-image">
<img src="http://boienkoping.se/media/com_jbusinessdirectory/pictures/companies/72/mat-1454599830.jpg" alt="DEMO">
</div>
</div>'],
];
function setMarkers(map, locations) {
// Add markers to the map
// Marker sizes are expressed as a Size of X,Y
// where the origin of the image (0,0) is located
// in the top left of the image.
// Origins, anchor positions and coordinates of the marker
// increase in the X direction to the right and in
// the Y direction down.
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < locations.length; i++) {
var company = locations[i];
var pinColor = "0071AF";
var pinImage = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=B|" + pinColor+"|FFFFFF",
new google.maps.Size(21, 34),
new google.maps.Point(0,0),
new google.maps.Point(10, 34));
var pinShadow = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_shadow",
new google.maps.Size(40, 37),
new google.maps.Point(0, 0),
new google.maps.Point(12, 35));
var shape = {
coord: [1, 1, 1, 20, 18, 20, 18 , 1],
type: 'poly'
};
if(company[2] != '0') {
pinImage = new google.maps.MarkerImage(company[2],
// This marker is 20 pixels wide by 32 pixels tall.
new google.maps.Size(32, 32),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
new google.maps.Point(0, 32));
}
var myLatLng = new google.maps.LatLng(company[0], company[1]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
icon: pinImage,
shadow: pinShadow,
shape: shape
});
var contentBody = company[3];
var infowindow = new google.maps.InfoWindow({
content: contentBody,
maxWidth: 250
});
google.maps.event.addListener(marker, 'click', function(contentBody) {
return function() {
infowindow.setContent(contentBody);//set the content
infowindow.open(map,this);
}
} (contentBody));
bounds.extend(myLatLng);
}
map.fitBounds(bounds);
var listener = google.maps.event.addListener(map, "idle", function() {
if (map.getZoom() > 16) map.setZoom(16);
google.maps.event.removeListener(listener);
});
}
function loadScript() {
if(!initialized) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize";
document.body.appendChild(script);
initialized = true;
}
}
var initialized = false;
function toggleStreetView() {
var toggle = panorama.getVisible();
if (toggle == false) {
panorama.setVisible(true);
} else {
panorama.setVisible(false);
}
}
 
 
 

3 Item(s)

Show per page