Skip to content

Instantly share code, notes, and snippets.

@Dziuperman
Created July 5, 2019 04:29
Show Gist options
  • Save Dziuperman/89e44eb19b3e10abcce523a77b1504a0 to your computer and use it in GitHub Desktop.
Save Dziuperman/89e44eb19b3e10abcce523a77b1504a0 to your computer and use it in GitHub Desktop.
Iframe for google docs
<script>
// Google docs (documents viewer)
function showDocs(oLink) {
var oBlock = oLink.getElementsByTagName('div')[0];
var oIframe = oLink.getElementsByTagName('iframe')[0];
var oIframeUrl = oLink.getAttribute('url-show');
if(oBlock.style.height == 0+'px') {
oBlock.style.height = 980+'px';
if(oIframe.src != oIframeUrl) {oIframe.src = oIframeUrl};
} else {
oBlock.style.height = 0+'px';
}
}
</script>
<div url-show="http://docs.google.com/viewer?url=<?php echo $file_url; ?>&amp;embedded=true" class="show_docs" onclick="showDocs(this); return false;">
<span>Посмотреть</span>
<div class="file_block" style="height: 0px;">
<iframe src="" height="980" width="620"></iframe>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment