-
-
Save crystalw/4390b9622cb032cde9c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // iframes | |
| var $iframes = $( document.querySelectorAll( '.widget iframe' ) ); | |
| function iframeSizing() { | |
| var $this = $( this ), | |
| width = $this.width(), | |
| height = $this.height(), | |
| containerWidth = $this.parent().width(), | |
| heightRatio = height / width, | |
| newHeight = heightRatio * containerWidth; | |
| $this.width( containerWidth ); | |
| $this.height( newHeight ); | |
| } | |
| function iframesEachSizing() { | |
| $iframes.each( iframeSizing ); | |
| } | |
| iframesEachSizing(); | |
| $( window ).resize( iframesEachSizing ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment