javascript - Hide a div element when I click everywhere inside a map and not on the marker -


sorry basic i'm still learning create basic map program. want hide div element when i'm not clicking on marker. managed show div using click event code:

var marker = new google.maps.marker({     map: map, });  marker.addlistener('click', function(event) {      // show div    }); 

but how hide div when i'm clicking outside of marker? enter image description here

just add click event map:

var my_div = document.getelementsbyclassname("custom_div")[0]; var jq_my_div = $('.custom_div'); // jquery  google.maps.event.addlistener(map, "click", function(event) {         my_div.style.display = 'none';         jq_my_div.hide(); // jquery }); 

when click on marker - doesnt't react on map click event.

jsfiddle: http://jsfiddle.net/4mtyu/2814/


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -