Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Commit

Permalink
fix(viewport-width): Fixes iframe width to anchor width
Browse files Browse the repository at this point in the history
- fixes #461
  • Loading branch information
alexander-heimbuch committed Jan 4, 2018
1 parent e076681 commit 531d816
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/embed/embed.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'babel-polyfill'
import { get, head, isString } from 'lodash'
import Bluebird from 'bluebird'
import browser from 'detect-browser'

import { findNode, createNode, appendNode, tag } from 'utils/dom'
import requestConfig from 'utils/request'
Expand All @@ -15,17 +14,18 @@ import iframeResizerContentWindow from 'raw-loader!iframe-resizer/js/iframeResiz
const playerSandbox = anchor => {
const frame = createNode('iframe')

if (browser.name === 'ios') {
frame.setAttribute('width', anchor.offsetWidth)
} else {
frame.setAttribute('width', '100%')
}
frame.setAttribute('width', anchor.offsetWidth)

frame.setAttribute('min-width', '100%')
frame.setAttribute('seamless', '')
frame.setAttribute('scrolling', 'no')
frame.setAttribute('frameborder', '0')

// Reset the width on viewport resize
window.addEventListener('resize', () => {
frame.setAttribute('width', anchor.offsetWidth)
})

appendNode(anchor, frame)
return frame
}
Expand Down

0 comments on commit 531d816

Please sign in to comment.