簡體   English   中英

Folium map填補手機空白

[英]Folium map fill white gap in mobile phone

我使用 Flask 制作了一個 web 應用程序,主體中有導航欄和 Folium map。 它在電腦上運行良好,但是當我嘗試在手機上打開它時,map 並沒有填滿整個屏幕。 所以我試着做這個 class

class React(MacroElement):
   _template = Template(u"""
            {% macro script(this, kwargs) %}
              $(window).on("resize", function() {
                $("#{{this._parent.get_name()}}").height($(window).height()).width($(window).width());
                {{this._parent.get_name()}}.invalidateSize();
                }).trigger("resize");
            {% endmacro %}
            """) #noqa
   
   def __init__(self):
        super(React, self).__init__()
        self._name = 'React'

然后通過m.add_child(React())添加到我的 map 中。 不幸的是,它並沒有改變任何東西。 另外我想避免使用全屏插件。 我嘗試了 CSS 方法,您將祖先容器的高度和寬度設置為 100%,但它不起作用

[已解決] 通過使祖先容器100vh100%然后添加這個

fig = branca.element.Figure(height="100%")
fig.add_child(m)

我不再需要React class

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM