Event propagation - Bootstrap popover - OpenLayers 3 -
i having problem event propagation.
the code:
var element = document.getelementbyid('popup'); var popup = new ol.overlay({ element: element, positioning: 'bottom-center', stopevent: false }); map.addoverlay(popup); //display popup on click map.on('click', function(evt){ var feature = map.foreachfeatureatpixel(evt.pixel, function(feature, layer){ return feature; } ); if (feature){ popup.setposition(evt.coordinate); $(element).attr('data-placement', 'top'); $(element).attr('data-html', true); $(element).attr('data-original-title', 'fermata<button type="button" id="close" class="close" onclick="$("#example").popover("hide");">×</button>'); $(element).attr('data-content', "<div> <b>nome: </b> ... </div>"); $(element).popover('show'); } else{ $(element).popover('destroy'); } }); this piece of code more or less taken openlayers 3 examples, nothing original here. close button popup bootstrap. when click on button, if there icon (the icon of geojson point layer) under button icon clicked too, , popup of icon open. don't want this. tried that:
$('.close').click(function (event) { console.log("close clicked"); event.preventdefault(); return false; } but did not work. in fact when there no icon below can see log in console, otherwise can't, think click event not fired.
any suggestions?
thanks!
Comments
Post a Comment