Google maps api v3 infowindow not showing on click -
i cant seem working. used on several other websites new 1 wont show infowindow (infobox).
markers in position , when on marker showing title.
i can post code comes lot of php , bit of mess.
this url:
http://intertyre.server170.nognietactief.nl/montagepunten
i utilize exact same sript on:
http://www.tyfoonbanden.nl/tyfoon-dealers
working perfect.
dont know why happening if there knows causing problem. please share because dont know.
thanks in advance.
the code (i know mess, have
<script type="text/javascript"> var geocoder; var map; var side_bar_html = ""; var gmarkers = []; var infobox; function initialize() { // create array of styles. var blueoceanstyles = [ { featuretype: "all", elementtype: "all", stylers: [ { saturation: -100 } // <-- ] } ]; geocoder = new google.maps.geocoder(); var myoptions = { zoom: <?php if(is_array($postcodevelden) && count($postcodevelden) > 0 && !empty($_post['address'])) { switch($radius) { case "5": echo "12"; break; case "10": echo "11"; break; case "15": case "20": echo "10"; break; case "30": case "40": echo "9"; break; } }else{ echo "7"; } ?>, center: new google.maps.latlng(<?php if(is_array($postcodevelden) && count($postcodevelden) > 0) { echo $lat.", ".$lon; } else { echo "52.2008737173322, 5.25146484375"; } ?>), maptypeid: google.maps.maptypeid.roadmap } map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); map.setoptions({styles: blueoceanstyles}); <?php if(is_array($adressen) , count($adressen) > 0) { foreach($adressen $adres) { $afstand = round((6371 * acos(sin(deg2rad($lat)) * sin(deg2rad($adres->locatie_lat)) + cos(deg2rad($lat)) * cos(deg2rad($adres->locatie_lat)) * cos(deg2rad($adres->locatie_lon) - (deg2rad($lon))))), 2); ?> addmarker(<?php echo $adres->locatie_lat.", ".$adres->locatie_lon.", '".$adres->locatie_naam."', '".$adres->locatie_straat."', '".$adres->locatie_postcode."', '".$adres->locatie_plaats."', '".$adres->locatie_telefoon."', '".$adres->locatie_website."', '".$afstand."'"; ?>); <?php } } ?> document.getelementbyid("table_markers").innerhtml = side_bar_html; } function myclick(i) { map.setcenter(gmarkers[i].getposition()); google.maps.event.trigger(gmarkers[i], "click"); } var infowindow = new google.maps.infowindow({ content: document.getelementbyid("infobox"), disableautopan: false, maxwidth: 250, pixeloffset: new google.maps.size(0, 0), zindex: null, boxstyle: { background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/tipbox.gif') no-repeat", opacity: 0.95, width: "280px" }, closeboxmargin: "12px 4px 2px 2px", closeboxurl: "http://www.google.com/intl/en_us/mapfiles/close.gif", infoboxclearance: new google.maps.size(1, 1) }); function addmarker(lat, lon, naam, straat, postcode, plaats, telefoon, website, afstand) { var marker = new google.maps.marker({ position: new google.maps.latlng(lat, lon), map: map, icon: "/wp-content/uploads/wheel-icon.png", title: naam }); google.maps.event.addlistener(marker, 'click', function() { var contentstring = '<div id="infobox">'+ '<b style="border-bottom: 1px solid #000000; color:#00377b;">' + naam + '</b><br/>'+ straat + '<br/>' + postcode + ' ' + plaats + '<br/>'; if(telefoon != "") { contentstring = contentstring + telefoon + '<br/>'; } if(website != "") { contentstring = contentstring + 'website: <u><a target="_blank" rel="nofollow" href="http://' + website + '">' + website + '</a></u>'; } contentstring = contentstring + '</div>'; infowindow.setcontent(contentstring); infowindow.open(map, marker); }); gmarkers.push(marker); side_bar_html += '<table id="marker_list"><tr>'+ '<td onclick="javascript:myclick(' + (gmarkers.length-1) + ')"><a><h3>' + naam + '</h3>' + straat + '<br/>' + postcode + ' ' + plaats + '<br/>' + telefoon + '<br/>' + website + '<br/>' + '<u>afstand ' + afstand + ' km</u>' +'</td>' +'<\/a></tr></table><br>'; } google.maps.event.adddomlistener(window, 'load', initialize); </script> <form action="/montagepunten" method="post"> <input id="address" name="address" type="textbox"<?php if(isset($_post['zoekpost']) && $_post['zoekpost'] == 'zoek') { echo " value=\"".$_post['address']."\""; } ?> style="float:left; height:30px; margin-right:10px; width:100px;"><select name="afstand" style="display:none;"> <option selected="selected" value="10">10 km</option> </select> <input type="submit" name="zoekpost" id="zoekpost" value="zoek"> </form> <br/> <br/> <div class="mapborder"> <div class="map-width"> <div id="map_canvas"></div> </div> <div class="one_third-last" style="overflow-y:auto; overflow-x:hidden; height:579px; width:100%; clear:left; padding-top:0px; padding-bottom:0px; margin-top:20px;"><div id="table_markers"></div></div> </div>
problem solved...
nothing wrong code there conflict loading google maps api multiple times.
using avada theme website. other users run this:
wp dashboard > appearance > theme options > options page.
there can disable google maps api avada , error gone.
google-maps google-maps-api-3 google-maps-markers infowindow
No comments:
Post a Comment