Skip to content
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

Maximum width #10

Closed
rafeblandford opened this issue Oct 7, 2011 · 4 comments
Closed

Maximum width #10

rafeblandford opened this issue Oct 7, 2011 · 4 comments

Comments

@rafeblandford
Copy link

It would be helpful to add support for maximum width (i.e. specify a max width beyond which video should not be fluid, this helps prevent videos from getting too big).

I have tried to do this myself, but without success. I'm sure there's a way to do this, but not being a JavaScript Ninja could not work out where to make the changes.

For other looking at this - a work around which does work is, of course, to place the iframe is <p> / <div> and add a max-width css statement to that. However that requires extra markup, which seems a shame for a drop in solution.

@davatron5000
Copy link
Owner

The only way to do this would be as you described, apply a min/max width to apply yet another wrapper around the .fluid-width-video-wrapper. I'll think about and look at adding this in.

@rafeblandford
Copy link
Author

Thank you. That gave me the clue I needed.

For the benefit of others wanting a quick fix.

Changing line 67 (added <div class="videocontent">)

$this.wrap('<div class="videocontent"><div class="fluid-width-video-wrapper" />').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");

I'm specifying the videocontent class in my css file, but I imagine you could add it to Javascript:

.videocontent {max-width:750px;margin:0 auto;}

I've put in the css file so I can optionally do media query changes. BTW My rationale for this is that some YouTube videos break down over 850px wide/ Not an issue unless you have a wide design. It also make it easier to adding in margins should that be your thing.

It's not great having two wrapping divs, but it does seem to work nicely in test I've done so far.

Thanks for FixVid.js - really appreciate it. Only responsive issue left is dealing with banner ads :)

@davatron5000
Copy link
Owner

Merging with #19

@nevergone
Copy link

This is merged and committed?

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