I would only display a tooltip on a device without a touchscreen. A popup and a tooltip will be displayed on your mobile by clicking on the point. I would like to see only popup

 var ubytovaci = L.geoJSON(null, {
    onEachFeature:  forEachFeature2,

    pointToLayer: function (feature, latlng) {
        return L.marker(latlng, {icon: iubyt}).bindTooltip(feature.properties.name);
    filter: function (feature, layer) {
        return (feature.properties.category == "6");

If I understand your question correctly, you want different behaviour on devices with touchscreen capabilities: no tooltip shown on such devices. For this you can use touch property of L.Browser namespace. Property L.Browser.touch is set to true for touchscreen devices.

Your code could be something like:

pointToLayer: function (feature, latlng) {
  var marker = L.marker(latlng, {icon: iubyt});
  if (L.Browser.touch)
    return marker;
    return marker.bindTooltip(feature.properties.name);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.