From 6c00f96a0d3f15d211bdab4c9bdd779577839d04 Mon Sep 17 00:00:00 2001 From: daihh Date: Thu, 2 Mar 2023 13:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/study/courseStudy.vue | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pages/study/courseStudy.vue b/pages/study/courseStudy.vue index b48c262..28ac049 100644 --- a/pages/study/courseStudy.vue +++ b/pages/study/courseStudy.vue @@ -581,12 +581,20 @@ setTimeout(function(){ var scormIframe=document.getElementById('iframe-scorm'); if (scormIframe) { - var iframeWin = scormIframe.contentWindow || scormIframe.contentDocument.parentWindow; - if (iframeWin.document.body) { - scormIframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight; - } + let iframeWin = scormIframe.contentWindow; + let iframeDoc = scormIframe.contentDocument || scormIframe.document; + + let cHeight = Math.max(iframeDoc.body.clientHeight,iframeDoc.documentElement.clientHeight); + let sHeight = Math.max(iframeDoc.body. scrollHeight,iframeDoc.documentElement.scrollHeight); + let winHeight = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight; + + let lheight = Math.max(cHeight, sHeight); + let finalHeight = Math.max(lheight, winHeight ); + + scormIframe.height =finalHeight; + console.log('scormIframe.height',scormIframe.height); } - },500); + },1500); }, loadMyScore(){