Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Iframe中的Iframe。这能做到吗?_Javascript_Jquery_Html_Iframe_Vimeo Api - Fatal编程技术网

Javascript Iframe中的Iframe。这能做到吗?

Javascript Iframe中的Iframe。这能做到吗?,javascript,jquery,html,iframe,vimeo-api,Javascript,Jquery,Html,Iframe,Vimeo Api,我们有一个视频(vimeo)链接,我们希望我们的用户观看 每个视频后面都有一个简短的调查问卷 我们的目的是在用户点击打开视频查看之前,不让用户看到调查问卷 我只能考虑将下面的代码嵌入到另一个iframe中以隐藏链接 这可能吗 有没有其他办法 <!DOCTYPE HTML> <html> <head> <meta name="google" value="notranslate" /> <meta http-equiv="Con

我们有一个视频(vimeo)链接,我们希望我们的用户观看

每个视频后面都有一个简短的调查问卷

我们的目的是在用户点击打开视频查看之前,不让用户看到调查问卷

我只能考虑将下面的代码嵌入到另一个iframe中以隐藏链接

这可能吗

有没有其他办法

<!DOCTYPE HTML>
<html>
<head>
    <meta name="google" value="notranslate" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Dog Smoking</title>

    <style type="text/css">
    body {
        padding-top:0;
        padding-bottom:0;
        padding-left:0;
        padding-right:0;
        margin-top:0;
        margin-bottom:0;
        margin-left:0;
        margin-right:0;
    }
    </style>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="javascript/froogaloop.js"></script>
    <script src="javascript/froogaloop.min.js"></script>
 <script type="text/javascript">
 var iframe = $('#player1')[0],
 player = $f(iframe),
 status = $('.status');

 // When the player is ready, add listeners for pause, finish, and playProgress
 player.addEvent('ready', function() {
     status.text('ready');

     player.addEvent('pause', onPause);
     player.addEvent('finish', onFinish);
     player.addEvent('playProgress', onPlayProgress);
 });

 // Call the API when a button is pressed
 $('button').bind('click', function() {
     player.api($(this).text().toLowerCase());
 });

 function onPause(id) {
     status.text('paused');
 }

 function onFinish(id) {
     status.text('finished');
 }

 function onPlayProgress(data, id) {
     status.text(data.seconds + 's played');
}
player.addEvent('ready', function() {
    status.text('ready');
    $("#survey_button").show(); // <-- or whatever
});
</script>
</head>
<body>
    <iframe src="http://player.vimeo.com/video/4644119?api=1" width="400" height="375" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
    <a href="http://show.aspx?testid=27#activate"
    target="target-iframe"
    onclick="frames['target-iframe'].document.getElementById('activate')
    .scrollIntoView();return false">Click</a>
</body>
</html>

吸烟
身体{
填充顶部:0;
填充底部:0;
左侧填充:0;
右边填充:0;
边际上限:0;
页边距底部:0;
左边距:0;
右边距:0;
}
变量iframe=$('#player1')[0],
player=$f(iframe),
状态=$('.status');
//播放器准备好后,添加暂停、完成和播放进度的侦听器
player.addEvent('ready',function(){
状态。文本(“就绪”);
player.addEvent('pause',onPause');
player.addEvent('finish',onFinish);
player.addEvent('playProgress',onPlayProgress);
});
//按下按钮时调用API
$('button').bind('click',function(){
api($(this.text().toLowerCase());
});
函数onPause(id){
status.text(“暂停”);
}
函数onFinish(id){
status.text('finished');
}
函数onPlayProgress(数据,id){
status.text(data.seconds+‘s played’);
}
player.addEvent('ready',function(){
状态。文本(“就绪”);
$(“#survey_button”).show();//我会使用内置在播放器中的事件回调使问卷可见

==更新==

好的-这个链接是一个如何为玩家合并JS控件和回调的一步一步的例子

步骤1是在初始嵌入代码之后添加“?api=1”

第2步是加载他们的Froogaloop库,以便您可以侦听事件

第3步是设置一个回调函数来处理任何您想要收听的事件……本页的示例非常棒:

var iframe = $('#player1')[0],
player = $f(iframe),
status = $('.status');

// When the player is ready, add listeners for pause, finish, and playProgress
player.addEvent('ready', function() {
    status.text('ready');

    player.addEvent('pause', onPause);
    player.addEvent('finish', onFinish);
    player.addEvent('playProgress', onPlayProgress);
});

// Call the API when a button is pressed
$('button').bind('click', function() {
    player.api($(this).text().toLowerCase());
});

function onPause(id) {
    status.text('paused');
}

function onFinish(id) {
    status.text('finished');
}

function onPlayProgress(data, id) {
    status.text(data.seconds + 's played');
}
所以,根据你希望调查显示的时间,你可以点击其中一个

player.addEvent('ready', function() {
    status.text('ready');
    $("#survey_button").show(); // <-- or whatever
});
player.addEvent('ready',function(){
状态。文本(“就绪”);

$(“#调查按钮”).show()/TL;DR Answer


是的,您可以在iframe中使用iframe。虽然从性能上来说,这通常不是一个好主意。

同源策略阻止通过iframe进行跨域通信。也许您应该尝试使用Ajax和一些服务器端语言?您好,此链接不是很直观。您有一个锯齿状的示例吗?非常感谢。抱歉我花了这么长时间才看到您的更改。我昨晚检查了一下,但什么也没看到。好的,请查看上面更新的代码。我可以看到视频,但我也可以看到
Clicl
链接。我们希望将该链接隐藏在iframe中,或者在用户观看视频后以某种方式使其可用。我错过了什么吗?P请看上面更新的代码。你能提供一个JSFIDLE或类似的吗?你必须编辑我的代码才能使用你的代码…非常感谢你的帮助。这是FIDLE,如果链接只能在视频播放结束后显示
,那将非常棒。我希望你能帮助解决这个问题。