I've been searching on the forum how to make a marker infowindow close when opened, when you click on another marker.
I've solved it and thought maybe it could help some !
In administrator/component/com_phocamaps/helpers/phocamapmaps.php ->
Line 305
Code: Select all
function setMap() {
// Not var as the map is global variable so not disable the global effect
return 'var myinfowindow;'."\n".$this->_map.' = new google.maps.Map(document.getElementById(\''.$this->_name.'\'), '.$this->_options.');'."\n";
//adds a global variable called myinfowindow
}
Code: Select all
$output .= ' google.maps.event.addListener(markerPhocaMarker'.$name.$this->_id.', \'click\', function() {'."\n"
.' if(myinfowindow) myinfowindow.close();'."\n"//check if windowinfo is opened and close it before opening another
.' infoPhocaWindow'.$name.$this->_id.'.open('.$this->_map.', markerPhocaMarker'.$name.$this->_id.' );'."\n"
.'myinfowindow = infoPhocaWindow'.$name.$this->_id."\n" //pass the infoPhocaWindow elements to myinfowindow
.' });'."\n";
if ($open) {
$output .= ' google.maps.event.trigger(markerPhocaMarker'.$name.$this->_id.', \'click\');'."\n";
}
return $output;
}
Enjoy and please comment if you have a better idea ^^