Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is the javascript(say script.js file) for putting markers on map for the events(in your case):</p> <pre><code>var map = false; var markers = []; (function () { var s = document.createElement('script'); s.type = 'text/javascript'; s.src = 'http://maps.googleapis.com/maps/api/js?key=AIzaSyDualhHxdg8nNCo4xY6gIfedyaHffW99UI&amp;libraries=geometry,places&amp;sensor=false&amp;callback=initialize'; document.body.appendChild(s); })(); function initialize() { var geocoder = false; map = new google.maps.Map(document.getElementById('map'), { zoom: 15, mapTypeId: 'grayscale', scrollwheel: false, overviewMapControl: false, panControl: false, rotateControlOptions: false, streetViewControl: false, mapTypeControl: false }); map.mapTypes.set("grayscale", new google.maps.StyledMapType([{ featureType: 'all', elementType: 'all', stylers: [{ saturation: -80 }] }], { name: 'Grey Scale' })); geocoder = new google.maps.Geocoder(); geocoder.geocode({ address: 'Saudi Arabia' }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { //this get the longitude and latitude of the saudi arabia var center = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()); //this focuses on the saudi arabia map.setCenter(center); // Get the coordinates of the center of the map var center = map.getCenter(); google.maps.event.addListenerOnce(map, 'bounds_changed', function () { //ajax to get event location with longitude and latitude from database xhr = $.ajax({ url: '/joey/event', data: { param:"your param" }, dataType: 'json', success: function (data) { //then run loop over json data to add the markers on the map for the events //code in loop start // Here you can put the latitude and longtitude associated with event var center = new google.maps.LatLng(latitude, longitude); var event = new google.maps.Marker({ map: map, title: "event name", zIndex: 10000, icon: 'event-icon.png', position: new google.maps.LatLng(jlat, jlng) }); markers.push(event); //code in loop end } }); }); } }); } </code></pre> <p>In the html page simply put:</p> <pre><code>&lt;div id="map"&gt;&lt;/div&gt; &lt;script type="text/javascript" src="script.js" defer&gt;&lt;/script&gt; </code></pre> <p>I hope this can be of some help to you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload