Skip to content

Instantly share code, notes, and snippets.

@moderatorwes

moderatorwes/article.html

Last active Jun 23, 2020
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();
@mtamosaitis

This comment has been minimized.

Copy link

@mtamosaitis mtamosaitis commented Jun 23, 2020

Wes, when I use this I now I get no preview available. do you have time to help me see whats going on?

@moderatorwes

This comment has been minimized.

Copy link
Owner Author

@moderatorwes moderatorwes commented Jun 23, 2020

Wes, when I use this I now I get no preview available. do you have time to help me see whats going on?

@mtamosaitis - Since this code is pretty old I have no idea if it works anymore or not.

@mtamosaitis

This comment has been minimized.

Copy link

@mtamosaitis mtamosaitis commented Jun 23, 2020

Do you have or know of anything that is more current?

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.