pythonscrollbaroverflowfolium

How to add scrollbar to Python Folium popup?


How do you add a vertical scrollbar to a Python Folium map popup? I have too much information to display that the popup spans the entire screen currently.


Solution

  • Use an iframe object and add it to the folium.popup object. Heres an example code:

    import branca 
    
    iframe = branca.element.IFrame(html='hello world' , width=500, height=400)
    
    popup = folium.Popup(iframe, max_width=500 )
    

    This example code automatically adds a scroll bar. Make sure your iFrame width matches the max width of the folium popup or else your scroll bar will not be within the bounds of the pop up object.