简体   繁体   English

使传单地图响应移动

[英]Make leaflet map mobile responsive

I have built a leaflet with leaflet package in R. Here a simplified version of the code used 我已经在R中使用传单包构建了传单。这里是所用代码的简化版本

library(leaflet) 图书馆(传单)

# dumb data
Points <- data.frame(lon = c(41.889, 41.882, 41.891), lat = c(12.455, 12.446, 12.459))

# web map
wland <- 
  leaflet(data = Points) %>% 
  addTiles() %>%
  addCircleMarkers(col = "red", 
                   fillOpacity = 1, 
                   radius = 5,
                   stroke = TRUE,
                   clusterOptions = markerClusterOptions(
                     maxClusterRadius=35, disableClusteringAtZoom=14
                   )) 

saveWidget(wland, "To:/Your/Path/map.html", selfcontained = FALSE)

I uploaded the html along with all javascript here . 我在这里将html和所有javascript一起上传。 It looks fine on desktop, but on mobile it does not respond well: markers remain too small, etc. Do you know how to make leaflet mobile responsive? 在台式机上看起来不错,但在移动设备上却无法很好地响应:标记保持太小等。您知道如何使传单对移动设备敏感吗? Shall I modify sometihng in the javascript created by R-leaflet? 我应该在R-leaflet创建的javascript中修改sometihng吗?

Thanks, Jacopo 谢谢,雅各布

This is what you need. 这就是你所需要的。 It´s pretty simple: http://leafletjs.com/examples/mobile/ 非常简单: http//leafletjs.com/examples/mobile/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM