SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Help needed with Google maps API

    Hi,
    I am trying to add custom Control to my map, but for some reason , the browser is showing myMap.controls as undefined

    here is my code>>>>
    var myMap;
    function HomeControl()
    {
    homeControl=$("<div id='mapHomeControl'></div>");
    $(homeControl).css("background-image",".\images\gui\homeIcon24.png");

    google.maps.event.addDomListener(homeControl, 'click', function() {
    myMap.setCenter(myLatLng);
    });

    }
    function addHomeControl()
    {

    HomeControl();
    homeControl.index = 1;

    myMap.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(homeControl);

    }

    function displayMap(lat,lng,zoomLevel)
    {setMapProperties(lat,lng,zoomLevel);
    createMap();

    }
    function createMap()
    {
    var map=document.getElementById('myMap');
    myMap= new google.maps.Map( map,
    mapOptions);
    addHomeControl();
    }


    If anyone can please help me as to where I am going wrong .

    Thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its giving type error a[z] is undefined

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok ,I have fixed the issue, for some reason, my jQuery statements were not adding appropriate styles and creating divs :S , now I am using javascript, and it works!

    Hope this will help someone...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •