Skip to content

Tweak the default width #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ocefpaf opened this issue Oct 29, 2015 · 4 comments
Closed

Tweak the default width #219

ocefpaf opened this issue Oct 29, 2015 · 4 comments

Comments

@ocefpaf
Copy link
Member

ocefpaf commented Oct 29, 2015

I experiment master with jupyter yesterday and the default width is adding a left-right scroll bar. We might need to tweak this a little bit.

@BibMartin
Copy link
Contributor

You're true, I get the same thing. But it depends on the browser, resolution etc.

There's the same issue in mplleaflet and you can have a look at jwass/mplleaflet#22 for ideas.

We can :

  • Keep a fixed size and decrease it so that it will fit in most browsers

  • Set the width to "100%" and use a fixed value for the height (600px seems reasonable to me).

  • Use a trick inspired from http://fettblog.eu/blog/2013/06/16/preserving-aspect-ratio-for-embedded-iframes/ to set width to 100% and force a given aspect ratio (66% in this example).

    iframe = '<iframe src="{html}" style="position:absolute;width: 100%;height: 100%;left: 0; top: 0;"></iframe>'\
        .format(\
                html = "data:text/html;base64,"+base64.b64encode(html.encode('utf8')).decode('utf8'),
               )            
    aspect_ratio_div = """
        <div style="position: relative; width: 100%;height: 0;padding-bottom: 66%;">{}</div>
        """.format(iframe)
    return aspect_ratio_div
    

@ocefpaf
Copy link
Member Author

ocefpaf commented Oct 29, 2015

Set the width to "100%" and use a fixed value for the height (600px seems reasonable to me).

Sounds good to me.

@andrewgiessel
Copy link
Contributor

I kinda like the fixed proportion trick, but 100% x 600px is fine too.

ps: hi!

BibMartin pushed a commit to BibMartin/folium that referenced this issue Oct 30, 2015
ocefpaf added a commit that referenced this issue Oct 30, 2015
@ocefpaf
Copy link
Member Author

ocefpaf commented Oct 30, 2015

Fixed in #221.

Thanks @BibMartin for the PR and @andrewgiessel for highlighting a better option than mine 😉

@ocefpaf ocefpaf closed this as completed Oct 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants