Skip to content

Instantly share code, notes, and snippets.

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

Embed
What would you like to do?
Zendesk: Embed PDF
<!--Add this to your article page using the Source editor -->
<iframe src="https://docs.google.com/gview?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true" 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.
}).resize();
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.