I am using react leaflet tooltip for a mapbox map.
I'm having a lot of trouble trying to keep react leaflet tooltip open when the mouse is over either the marker or the tooltip itself? I want to be able to open on hover and then click on something inside the tooltip, and I want to close when the mouse leaves the marker or the tooltip.
So if the mouse is in the red then the tooltip is open, and if it is not, then the tooltip is closed.
Any pointers appreciated
I tried what was available in the api https://leafletjs.com/SlavaUkraini/reference.html#tooltip, but I think there may be more customization I don't have the expertise to build may be needed to pull off this behavior.
One way to do it is to not set it to close when the mouse leaves.
Then it will be up to the user to either click on the map or click "close" to close the popup.
If any other markers are hovered that show popups then the original one will be automatically closed.
According to the Mapbox GL JS Quickstart guide, it should be straightforward to implement a map on a website using the Mapbox CDN. Unfortunately, that is not the case if the map is located inside a Bootstrap modal, which does not have a predefined width, a property that is set only after the modal is opened.
The result is a Mapbox canvas loaded with a default width of 400px, which may differ from the modal width and create a terrible user experience.
Also, if one opens the modal and then resizes the browser window, the map automatically fits the whole horizontal space as expected, which seems to be a JavaScript response to a resize event.
Here follows the related code.
HTML file
<div id='map'></div>
CSS file
#map {
height: 300px;
}
JS file
mapboxgl.accessToken = '...';
var map = new mapboxgl.Map({
container: 'map',
center: [..., ...],
zoom: 10,
style: 'mapbox://styles/mapbox/streets-v11'
});
I've tried to load Mapbox inside a Bootstrap 3.4.0 modal, as I was previously able to do when using Google Maps or Bing Maps, but in both cases embedded inside an iframe. Therefore, I was expecting to see Mapbox filling the whole modal as Google Maps and Bing Maps did.
Instead, the Mapbox interface (bottom left logo and bottom right info button) was correctly positioned inside the modal, at its borders, but the canvas containing the map was incorrectly positioned.
Finally, setting a predefined width to the #map CSS property is not a solution. If the width is set to a fixed width in pixels, it may not display properly on all window sizes, while adding a fixed percentage width, say 100%, did not do the trick.
A similar issue has already been solved for the Leaflet JavaScript library here and here.
As it turns out, the lack of a predefined width for the modal leaves Mapbox with no option but to initially load a default width (400px in this case). Because opening the modal does not trigger any event that Mapbox may be listening to, such as the window resizing, Mapbox keeps its default width no matter the size set for the modal once it is displayed.
Therefore, to make the Mapbox canvas to fill the entire width of the modal, one must link the opening of the modal, which will finally set a width to it, to the Mapbox resize method.
The Bootstrap event of interest here is the "shown.bs.modal", which is triggered once the modal has been displayed to the user and the CSS transitions have completed. This guarantees that a width has already been set to the modal.
The solution is to add the following code after the 'map' variable definition in the JS file:
$('#modalID').on('shown.bs.modal', function() {
map.resize();
});
Make sure to change 'modalID' to the same 'id' used to identify the respective modal.
I am using Gmap on my website and I notice that i sets position:relative on the #map. How do I change this? I don't want any positioning on the #map div. I looked over the gmaps.js and couldn't find it.
Another problem is how to make the gmap load in satellite mode by default instead of map?
Also can I get rid of all the other things I get by default - zoomer, arrows, text at the bottom right etc. I just want a clean map in satellite mode.
Hi I made an imagemap with area polygons which has tooltips over each polygon whilst the mouse is hovering over it.
I've also got a legend at the bottom of the image map, what I'd like to achieve is to whilst having the mouse over the specific item in the legend showing the tooltip on the specific polygon area.
Thanks in advance
While its not possible to force the same behavior as the title attribute gives you can use either http://jqueryui.com/tooltip/ or a css based tooltip http://www.webdesignerdepot.com/2012/11/how-to-create-a-simple-css3-tooltip/ to react to an onmouseover/onmouseleave event on your legend elements
How can I create this page ?
http://www.kiwicollection.com/search/map
icon loading marker
sidebar
popup dialog
button on map
How can I learn how to do.
This is a simple jquery work.
for popup dialog you can check the custom popup link that work on mouse over on marker.
Button on map is just some images in background and numbers are show on above of that.
check change marker image tutorial
sidebar is just trick that work on mouse over on map and hide the side div and increase the length of map.
Examples are here
similarly i think icon loading marker is also a image the loading is showing on mouseover event.