0

I am using gmap 3 for plotting map. i need to enable on click functionality on marker. am using the following code

var contact = {"lat":"26.207293", "lon":"50.583730"}; //Change a map coordinate here!
  try {
    var mapContainer = $('.map');
    mapContainer.gmap3({
      action: 'addMarker',
      marker:{
        options:{
          icon : new google.maps.MarkerImage('img/assets/marker.png')
        }
      },
      latLng: [contact.lat, contact.lon],
      map:{
        center: [contact.lat, contact.lon],
        zoom: 14
        },
      },
      {action: 'setOptions', args:[{scrollwheel:false}]}
    );
  } catch(err) {

  }

i tried this too.eventes function.still not woring.

events:{
              click:function(){
                alert("I'm the last one, and i have my own click event");
              }

1 Answer 1

1

I have tried your code, and changed a few things. This works:

var contact = {"lat":"26.207293", "lon":"50.583730"}; //Change a map coordinate here!
$("#my_map").gmap3({
  marker:{
    values: [[contact.lat, contact.lon]],
    options: {
      draggable: false
    },
    events:{
      click: function() {
        alert('bla');
      }
    }
  },
  map: {
    options: {
      center: [contact.lat, contact.lon],
      zoom: 14
    }
  }
});

Demo: http://jsfiddle.net/aJuBZ/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.