Skip to content

Instantly share code, notes, and snippets.

@cnasal
Created March 27, 2019 20:42
Show Gist options
  • Save cnasal/035d246aad430d9cfb91ada696f1a2ce to your computer and use it in GitHub Desktop.
Save cnasal/035d246aad430d9cfb91ada696f1a2ce to your computer and use it in GitHub Desktop.
<!-- Fix PDFs loaded in tabs -->
<script type="text/javascript">
jQuery(function() {
jQuery('.tab-link').click(function() {
setTimeout(function(){
if (typeof(Event) === 'function') {
// modern browsers
window.dispatchEvent(new Event('resize'));
} else {
// for IE and other old browsers
// causes deprecation warning on modern browsers
var evt = window.document.createEvent('UIEvents');
evt.initUIEvent('resize', true, false, window, 0);
window.dispatchEvent(evt);
}
}
, 100);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment