Created
April 26, 2012 00:57
-
-
Save SpencerCooley/2494913 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function enableClick(){ | |
map.on('click', function(e) { | |
var marker = new L.Marker(e.latlng, {draggable:true}); | |
map.addLayer(marker); | |
});//closes the click function | |
if(map.hasEventListeners('click') == true){ | |
alert('map still has an event listener'); | |
} | |
else{ | |
alert('map has no event listener'); | |
} | |
} | |
function disableClick(){ | |
map.off('click', function(){ | |
}); | |
if(map.hasEventListeners('click') == true){ | |
alert('map still has an event listener'); | |
} | |
else{ | |
alert('map has no event listener'); | |
} | |
} | |
//when | |
$('#enable_click').click(function(){ | |
var enable_click = new enableClick() | |
}); | |
$('#disable_click').click(function(){ | |
var disable_click = new disableClick(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment