JavaScript Mark point Google maps custom script mark point google maps

I have my custom script for map into my webpage,but it no have point mark for exactly ubication:

<script>
/* Map */
(function () {
    "use strict";

    if (document.getElementById("map")) {
        var locations = [
            ['<div class="map-info-box"><ul class="contact-info-list"><li><span><i class="fa fa-home fa-fw"></i></span> Mimar Sinan Mh., Konak/İzmir, Türkiye</li><li><span><i class="fa fa-phone fa-fw"></i></span> +90 0 (232) 324 11 83</li></ul></div>', 38.396652, 27.090560, 9]
        ];

        var map = new google.maps.Map(document.getElementById('map'), {
            zoom: 13,
            center: new google.maps.LatLng(29.0961599, -110.96087460000001),
            scrollwheel: false,
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            styles: [{ "featureType": "all", "elementType": "all", "stylers": [{ "saturation": -100 }, { "gamma": 0.5 }] }]
        });

        var infowindow = new google.maps.InfoWindow();


        var marker, i;

        for (i = 0; i < locations.length; i++) {
            marker = new google.maps.Marker({
                position: new google.maps.LatLng(locations[i][1], locations[i][2]),
                map: map,
                animation: google.maps.Animation.DROP,
                icon: 'images/pin.png',
            });

            google.maps.event.addListener(marker, 'click', (function (marker, i) {
                return function () {
                    infowindow.setContent(locations[i][0]);
                    infowindow.open(map, marker);
                }
            })(marker, i));
        }
    }

}());

So I need to add markpoint like default embed map http://www.map-embed.com/:

 <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<div style="overflow:hidden;height:500px;width:600px;">
<div id="gmap_canvas" style="height:500px;width:600px;"></div>
<style>#gmap_canvas img{max-width:none!important;background:none!important}    </style>
<a class="google-map-code" target='_blank' href="http://www.themecircle.net" id="get-map-data">www.themecircle.net</a>
</div>
<script type="text/javascript"> function init_map(){var myOptions = {zoom:13,center:new     google.maps.LatLng(29.0961599,-110.96087460000001),
mapTypeId: google.maps.MapTypeId.ROADMAP};map = new    google.maps.Map(document.getElementById("gmap_canvas"), myOptions);
     marker = new google.maps.Marker({map: map,position: new google.maps.LatLng(29.0961599, -110.96087460000001)});
      infowindow = new google.maps.InfoWindow({content:"<b>Minerals</b><br/>Reyes #100<br/>83190 Hermosillo" });
    google.maps.event.addListener(marker, "click", function(){infowindow.open(map,marker);});
    infowindow.open(map,marker);}
    google.maps.event.addDomListener(window, 'load', init_map);</script>

How can I that my marker appears like default map? Your answers are very apreciated

Answer:1

I think you need to put the marker declaration inside the initMap() function to put a default marker at a particular coordinate when a map is loaded. Here is the HTML + Javascript code from the official Google documentation.

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Simple markers</title>
    <style>
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      #map {
        height: 100%;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>

function initMap() {
  var myLatLng = {lat: -25.363, lng: 131.044};

  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 4,
    center: myLatLng
  });

  var marker = new google.maps.Marker({
    position: myLatLng,
    map: map,
    title: 'Hello World!'
  });
}

    </script>
    <script async defer
        src="https://maps.googleapis.com/maps/api/js?signed_in=true&callback=initMap"></script>
  </body>
</html>

For more details follow this document.

Answer:2

I have a link with an hover effect. When you hover it, the text become red and underlined. When you click it, the text stay red and underlined. My problem is that once you clicked on the link, the ...

I have a link with an hover effect. When you hover it, the text become red and underlined. When you click it, the text stay red and underlined. My problem is that once you clicked on the link, the ...

  1. hover click event jquery
  2. mouse hover click jquery
  3. hover after click jquery
  4. hover instead of click jquery
  5. remove hover on click jquery
  6. change hover to click jquery
  7. combine hover and click jquery
  8. jquery hover click conflict
  9. jquery hover click mobile
  10. hover and click function jquery
  11. convert hover to click jquery
  12. jquery hover click toggle
  13. disable hover after click jquery

I'm trying to retrieve a single result from a multi-dimensional array and then push that result into each object contained within an object array. Here is my code; var data = { "questions": ["...

I'm trying to retrieve a single result from a multi-dimensional array and then push that result into each object contained within an object array. Here is my code; var data = { "questions": ["...

  1. push property into object javascript
  2. push property into object
  3. push new property into object javascript
  4. javascript push property into array
  5. javascript push object property into array

I created a chart using the dimple.js library with the following code: var myChart = new dimple.chart(svg, data); var x = myChart.addMeasureAxis("x", "x-measure"); x.tickFormat = "%"; var y = myChart....

I created a chart using the dimple.js library with the following code: var myChart = new dimple.chart(svg, data); var x = myChart.addMeasureAxis("x", "x-measure"); x.tickFormat = "%"; var y = myChart....

I have a JavaScript associative array, say: var myArray = new Object(); myArray["id1"] = "completed"; myArray["id2"] = "notCompleted"; myArray["id3"] = "started"; How can I update value of each item ...

I have a JavaScript associative array, say: var myArray = new Object(); myArray["id1"] = "completed"; myArray["id2"] = "notCompleted"; myArray["id3"] = "started"; How can I update value of each item ...

  1. update each value in dictionary python
  2. php update each value in array
  3. c# update each value in dictionary
  4. python update each value
  5. sql update different value each row
  6. loadrunner update value on each occurrence
  7. c# update value of each item in list