-
-
Save cliftoncanady/7713270 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
| iframe { | |
| max-width: 100%; | |
| } |
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
| <!-- All you need is a defined width & height --> | |
| <iframe frameborder="0" height="426" src="http://www.slideshare.net/slideshow/embed_code/9812085?rel=0" width="510"></iframe> |
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
| function adjustIframes() | |
| { | |
| $('iframe').each(function(){ | |
| var | |
| $this = $(this), | |
| proportion = $this.data( 'proportion' ), | |
| w = $this.attr('width'), | |
| actual_w = $this.width(); | |
| if ( ! proportion ) | |
| { | |
| proportion = $this.attr('height') / w; | |
| $this.data( 'proportion', proportion ); | |
| } | |
| if ( actual_w != w ) | |
| { | |
| $this.css( 'height', Math.round( actual_w * proportion ) + 'px' ); | |
| } | |
| }); | |
| } | |
| $(window).on('resize load',adjustIframes); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment