Skip to content

Instantly share code, notes, and snippets.

@moderatorwes moderatorwes/article.html
Last active May 24, 2017

What would you like to do?
Zendesk: Embed PDF
<!--Add this to your article page using the Source editor -->
<iframe src="" style="width:600px; height:500px;" frameborder="0"></iframe>
//responsive Iframes (add below $document.ready)
// Find all iframes
var $iframes = $( "iframe" );
// Find &#x26; save the aspect ratio for all iframes
$iframes.each(function () {
$( this ).data( "ratio", this.height / this.width )
// Remove the hardcoded width &#x26; height attributes
.removeAttr( "width" )
.removeAttr( "height" );
// Resize the iframes when the window is resized
$( window ).resize( function () {
$iframes.each( function() {
// Get the parent container&#x27;s width
var width = $( this ).parent().width();
$( this ).width( width )
.height( width * $( this ).data( "ratio" ) );
// Resize to fix all iframes on page load.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.