Tuesday, October 23, 2012

Add Info Window in Google Maps

Adding an info window forms a integral part in the places where some note has to be placed , so inorder to use that inside Google maps this post will aid you !!!




<html>
<head>
<script type="text/javascript" src="../jquery/jquery-1.4.4.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script type="text/javascript" src="../gmap3.js"></script>
<style>
.gmap3{margin: 20px auto;border: 1px dashed #C0C0C0;width: 500px;height: 250px;}
</style>
<script type="text/javascript">
$(function(){
  $('#test1').gmap3({
    action: 'addInfoWindow',
    address: "Coimbatore,India",
    map:{
      center: true,
      zoom: 14
    },
    infowindow:{
      options:{
        size: new google.maps.Size(50,50),
        content: 'Hello World !'
      },
    events:{
      closeclick: function(infowindow){
        alert('closing : ' + $(this).attr('id') + ' : ' + infowindow.getContent());
      }
    },
    apply:[
      {action:'setContent', args:['Here is a new content !']}
    ]
    }
    },
    {action: 'setOptions', args:[{scrollwheel:true}]}
    );
  });
</script>
</head>

<body>
<div id="test1" class="gmap3"></div>
</body>
</html>

No comments:

Post a Comment