简体   繁体   English

在Xaringan演示文稿中嵌入javascript

[英]Embed javascript in Xaringan presentation

I have an interactive pooling question created using polleverywhere that would like to insert into my Xaringan rmarkdown presentation: 我有一个使用polleverywhere创建的交互式池问题,该问题想插入我的Xaringan rmarkdown演示文稿中:

<script src="https://www.polleverywhere.com/multiple_choice_polls/U43TXrlame7hw6J/web.js?height=250&results_count_format=percent&width=300"></script>

What is the right approach to achieve that? 什么是实现此目标的正确方法?

You need the <iframe> code instead. 您需要<iframe>代码。 Go to your poll at polleverywhere then click on "3. Present" > Share > Embed poll. 在polleverywhere进行投票,然后单击“ 3. Present”>“共享”>“嵌入投票”。 There will be a place that says "Copy and paste this snippet into your web page or blog". 会有一个地方显示“将此代码段复制并粘贴到您的网页或博客中”。 Copy a code that would look like: 复制如下代码:

<iframe src="https://embed.polleverywhere.com/multiple_choice_polls/XXX" width="100%" height="100%" frameBorder="0"></iframe>

and enter this to your slide. 并将其输入到您的幻灯片中。 Just a note that open your html output in a browser like Chrome and not the Viewer pane in RStudio because the latter doesn't show it. 请注意,请在类似Chrome的浏览器中打开html输出,而不要在RStudio中的“查看器”窗格中打开,因为后者不会显示它。

Alternatively if you want people to answer the question without leaving the presentation slide you can embed it as 或者,如果您希望人们在不离开演示幻灯片的情况下回答问题,则可以将其嵌入为

<iframe src="https://PollEv.com/multiple_choice_polls/XXX/web" width="100%" height="100%" frameBorder="0"></iframe>

replacing src url from "Shareable response link". 从“共享响应链接”替换src网址。 It works from Chrome but Firefox seems to squish a bit. 它可以在Chrome浏览器上运行,但Firefox似乎有点压缩。 Users have to identify who they are first though. 用户必须先确定自己是谁。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM