Skip to content

Commit

Permalink
Fix the youtube embed for smaller screens fastai#358
Browse files Browse the repository at this point in the history
Just a quick fix for the issue fastai#358.
  • Loading branch information
xpire committed Jun 19, 2021
1 parent ac945d2 commit da9790b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _includes/youtube.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
{% assign url = include.content | remove: "</a>" | split: ">" | last %}
{% assign base_url = url | split: "/" | last %}
{% endif %}
<center>
<iframe width="560" height="315" src="https://www.youtube.com/embed/{{base_url}}" frameborder="0" allowfullscreen></iframe>
<center class="youtube-iframe-wrapper">
<iframe width="730" height="315" src="https://www.youtube.com/embed/{{base_url}}" frameborder="0" allowfullscreen></iframe>
</center>
18 changes: 18 additions & 0 deletions _sass/minima/fastpages-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,21 @@ table {
pre code {
font-size: 15px !important;
}

// Handle youtube videos, so they dont break on mobile devices
.youtube-iframe-wrapper {
position: relative;
padding-bottom: 56.10%;
height: 0;
overflow: hidden;
}

.youtube-iframe-wrapper iframe,
.youtube-iframe-wrapper object,
.youtube-iframe-wrapper embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

0 comments on commit da9790b

Please sign in to comment.