Created
July 5, 2019 04:29
-
-
Save Dziuperman/89e44eb19b3e10abcce523a77b1504a0 to your computer and use it in GitHub Desktop.
Iframe for google docs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; ?>&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