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

feat(docs): add description for an iframe aspect ratio fix #263

Merged
merged 5 commits into from
Apr 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,26 @@ Sometimes it's preferable to hide Abstract-specific UI components within an embe

`https://app.goabstract.com/embed/c53e8159-2e24-4118-b02b-6fe4b3a3afee?chromeless`


## Create responsive embed to maintain aspect ratio

```html
<div style="position: relative; padding-top: 75%; min-width: 400px;">
<iframe
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
src="https://app.goabstract.com/embed/c53e8159-2e24-4118-b02b-6fe4b3a3afee"
frameborder="0"
allowfullscreen
>
</iframe>
</div>
```
Embed should have a wrapper, full width and height, so it would inherit the container size.
In this case, `padding-top` is responsible for an aspect ratio, and to get a value you have to divide height on the width and multiply by 100 (`height / width * 100`), which means that `3 / 4 * 100 = 75` - is our `padding-top` value.

More details can also be found [here](https://jameshfisher.com/2017/08/30/how-do-i-make-a-full-width-iframe/).


## Examples

The following examples demonstrate both layer and collection embeds created from the above share link.
Expand Down