Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.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
Php 在循环中加载视频…始终显示第一个视频-jquery问题?_Php_Jquery_Jwplayer - Fatal编程技术网

Php 在循环中加载视频…始终显示第一个视频-jquery问题?

Php 在循环中加载视频…始终显示第一个视频-jquery问题?,php,jquery,jwplayer,Php,Jquery,Jwplayer,我有一个加载不同视频的页面。如果这意味着什么,我会使用jw播放器作为播放器。我的问题很严重…JW播放器只播放第一个视频。无论我点击哪个链接,都会播放第一个视频 如果我看到了我的源代码(执行的html),视频被正确加载,即img1、链接到video1.flw、img2链接到video2.flw……等等。但是,无论单击哪个链接,都只播放第一个视频 任何人都能弄明白为什么会发生这种情况 以下是与视频相关的代码: 我在标题中有以下代码: <link href="style.css" rel="st

我有一个加载不同视频的页面。如果这意味着什么,我会使用jw播放器作为播放器。我的问题很严重…JW播放器只播放第一个视频。无论我点击哪个链接,都会播放第一个视频

如果我看到了我的源代码(执行的html),视频被正确加载,即img1、链接到video1.flw、img2链接到video2.flw……等等。但是,无论单击哪个链接,都只播放第一个视频

任何人都能弄明白为什么会发生这种情况

以下是与视频相关的代码:

我在标题中有以下代码:

<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type='text/javascript' src='js/jquery.simplemodal.js'></script>
<script type='text/javascript' src='js/basic.js'></script>
<script type="text/javascript" src="jwplayer/jwplayer.js"></script>

这是放置视频的代码:

<div id='basic-modal'>
<a href='#' class='basic'>
<img src="backOffice/backOfficeImages/<?php echo $r[instrument_image]; ?>" alt="" width="300" height="410" />
</a> 
</div>

<!-- modal content -->
<div id="basic-modal-content">  
<!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE -->
<div id="<?php echo $i;?>">JW Player goes here</div>

<script type="text/javascript">
jwplayer("<?php echo $i;?>").setup({ 
flashplayer: "/jwplayer/player.swf",
autostart:true,
file: "backOffice/videos/instruments/<?php echo $r[instrument_video]; ?>",
height: 360,
width: 640
});
</script>
<!-- END OF THE PLAYER EMBEDDING -->   
</div>
<!-- preload the images -->
<div style='display:none'>
<img src='images/x.png' alt='' />
</div>

<?php
$i++;
?>  

$i变量设置在该代码所在的while循环上方的0上。请注意,即使在同一个循环中,图像也会正确显示,在源代码中,视频是正确的(video1、video2、video3…),但只播放第一个视频,不知道单击哪个图像

有人能帮忙吗


关于Zoran,我看不到任何东西告诉每个链接打开一个特定的模式-我想它只是每次都默认为第一个模式

这完全取决于js/jquery.simplemodal.js和js/basic.js的内部内容(即必须连接链接的代码)

我希望在链接和模式中看到一些包含索引(0,1,2,3)的内容,然后您可以使用它将链接3绑定到模式3

示例(但我需要更多关于如何设置工作答案链接的信息):


同样-基本的想法是每个链接都必须对它应该启动的窗口有某种想法,当点击链接时,它使用这个来获得对正确视频模式的引用。

我看不到任何东西告诉每个链接打开一个特定的模式-我想它只是默认为第一个模式每一次

这完全取决于js/jquery.simplemodal.js和js/basic.js的内部内容(即必须连接链接的代码)

我希望在链接和模式中看到一些包含索引(0,1,2,3)的内容,然后您可以使用它将链接3绑定到模式3

示例(但我需要更多关于如何设置工作答案链接的信息):


同样-基本思想是,每个链接都必须对它应该启动的窗口有某种想法,当点击链接时,它会使用它来获取对正确视频模式的引用。

$(document).ready(function(){jQuery(function($){//Load dialog on page Load/$('#basic modal content')。modal();//单击$('#basic modal.basic')加载对话框。单击(函数(e){$('#basic modal content').modal();return false;});})下面是您锁定的basic.js的代码。非常感谢。你帮了我大忙。Cheees,zoran$(document).ready(function(){jQuery(function($){//$('basic modal content').modal();//单击$('basic modal.basic')加载对话框。单击(function(e){$('basic modal content').modal();return false;;}}}})这是你钉在上面的basic.js的代码。非常感谢。你帮了我大忙。干杯,佐兰
<div id='basic-modal' data-index="<?php echo $i;?>">
  ...
</div>


<div id="basic-modal-content" data-index="<?php echo $i;?>">  
  ...
</div>
// hook up the video links to launch the correct modal
$('div#basic-modal').bind('click', function() {

    // grab the index of the link that was clicked
    var linkIndex = $(this).attr('data-index');

    // get a reference to the corresponding modal
    var modal = $('div#basic-modal-content[data-index="' + linkIndex + '"]');

    // use whatever code you need to show the modal window
    modal.show();
});