Skip to content

Instantly share code, notes, and snippets.

@moderatorwes
Last active May 30, 2022 09:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moderatorwes/03a8fd4152f43a981bc12178b9238137 to your computer and use it in GitHub Desktop.
Save moderatorwes/03a8fd4152f43a981bc12178b9238137 to your computer and use it in GitHub Desktop.
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
Copy link

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

@moderatorwes
Copy link
Author

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
Copy link

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