javascript - Restrict google maps API marker to only one click per marker -
i'm creating simple map phonegap app click map, , marker added, , popup form shows. working fine, need make sure each marker clickable once.
this i've tried far:
google.maps.event.addlistener(clickmarker, 'click', function (e) { addlocations(this.getposition()); // calls popup form /* clickmarker.setoptions({ clickable: false });*/ clickmarker.setclickable(false); });
is i'm asking possible? if possible, doing wrong?
no, instead of set clickable false, try removing event listener
clickmarker.addlistener('click', //add listener marker object directly function (e) { addlocations(this.getposition()); // calls popup form // ever things want before calling // removing event, can call once google.maps.event.clearlisteners(clickmarker, "click"); // don't forget 's' });
since you're working phonegap, suggest use plugin google maps, it'll easier :
https://github.com/wf9a5m75/phonegap-googlemaps-plugin
-- carlos :-)
Comments
Post a Comment