使iframe中的iframe和视频响应

时间:2017-01-01 01:16:49

标签: css css3 iframe responsive

我使用PlusThis进行视频跟踪,下面的代码在查看网站的桌面版本时工作正常,但是,当我使用移动设备时,视频显然无法响应。

为了使用PlusThis功能,我需要使用下面的代码,而我无法弄清楚如何使其响应:

<iframe id="vimeo_187396498" src="https://player.vimeo.com/video/187388888" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<script type="text/javascript">
    PTFeatureBase.setContactId('[memb_contact fields="Id"]');
    PTFeatureBase.setContactEmail('[memb_contact fields="Email"]');
    PTVideoTriggers.listen({
        type: "vimeo",
        playerId: "vimeo_187399998",
        feature: "1545-MHe1qQxtRTKCd4cTdB5aDcedYjgJORyfcidK6gv1",
        triggerType: "cue",
        times: [660]
    });
</script>

有人可以告诉我如何使这段代码响应,同时仍然保持我需要的JavaScript,以便使用PlusThis的功能吗?

2 个答案:

答案 0 :(得分:0)

&#13;
&#13;
PTFeatureBase.setContactId('[memb_contact fields="Id"]');
   PTFeatureBase.setContactEmail('[memb_contact fields="Email"]');
   PTVideoTriggers.listen({
     type: "vimeo",
     playerId: "vimeo_187399998",
     feature: "1545-MHe1qQxtRTKCd4cTdB5aDcedYjgJORyfcidK6gv1",
     triggerType: "cue",
     times: [660]
   });
&#13;
iframe{
  width:100%;
  height:auto;
 }
&#13;
<iframe id="vimeo_187396498" src="https://player.vimeo.com/video/187388888" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

<iframe id="vimeo_187396498" src="https://player.vimeo.com/video/187388888" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

您在iframe标记内使用了宽度和高度。因此,请在div区域中使用iframe标记,并将css iframe用作div子级。请按照以下示例: HTML代码:

<div class="videoiframe">
<iframe id="vimeo_187396498" src="https://player.vimeo.com/video/187388888" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>

CSS代码:

.videoiframe iframe {width:100%; height: auto}

我希望,你明白了。