Javascript 缩放谷歌幻灯片iframe
我对网页设计相当陌生,目前我正在为我的学生在Moodle上创建一个在线课程。我想根据父窗口缩放嵌入式Google幻灯片演示文稿的iframe内容。我在以下网站上找到了解决方案: 然后将Google幻灯片代码包装在标签中:Javascript 缩放谷歌幻灯片iframe,javascript,html,css,moodle,Javascript,Html,Css,Moodle,我对网页设计相当陌生,目前我正在为我的学生在Moodle上创建一个在线课程。我想根据父窗口缩放嵌入式Google幻灯片演示文稿的iframe内容。我在以下网站上找到了解决方案: 然后将Google幻灯片代码包装在标签中: <div class="google-slides-container"> [Your Google Slides Embed iFrame Code] </div> [您的谷歌幻灯片嵌入iFrame代码] 我的问题是我没有Moodle的管
<div class="google-slides-container">
[Your Google Slides Embed iFrame Code]
</div>
[您的谷歌幻灯片嵌入iFrame代码]
我的问题是我没有Moodle的管理权限(无法访问文档标题、CSS样式表等)。我正在寻找一种在文档正文中包含这些属性的方法。我试图包含样式标记,但Moodle总是覆盖它们。有没有办法用JavaScript创建两个类“GoogleSlidesContainer”和“GoogleSlidesIframe”,或者在div标记中包含这些属性?非常感谢您,Marcus以下代码适用于我:
<div class="embed-container"
style="position: relative; padding-bottom: 59.27%; height: 0; overflow: hidden; max-width: 100%;">
<iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
src="[Enter src from Google Slides Embed iFrame Code]" frameborder="0" width="960" height="569" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
</div>
您可以根据需要更改填充底部百分比值
<div class="embed-container"
style="position: relative; padding-bottom: 59.27%; height: 0; overflow: hidden; max-width: 100%;">
<iframe style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
src="[Enter src from Google Slides Embed iFrame Code]" frameborder="0" width="960" height="569" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>
</div>