Jquery jPlayer不能在Joomla模板中工作
我用jPlayer制作了一个Joomla模板 下面是代码(我尽可能简单,播放器的代码来自jplayer.org):Jquery jPlayer不能在Joomla模板中工作,jquery,jplayer,joomla3.1,Jquery,Jplayer,Joomla3.1,我用jPlayer制作了一个Joomla模板 下面是代码(我尽可能简单,播放器的代码来自jplayer.org): 振作起来! 我已经找到了一个解决方案,但我不知道为什么会这样:D 我发现一个网站上有一个jPlayer,我将所有Javascript代码从该网站复制到我的项目中。。。 它正在工作。。。所以我删除了一些脚本标签 现在,标题中的脚本如下所示: <script type="text/javascript" src="http://ajax.googleapis.com/a
振作起来!
我已经找到了一个解决方案,但我不知道为什么会这样:D
我发现一个网站上有一个jPlayer,我将所有Javascript代码从该网站复制到我的项目中。。。
它正在工作。。。所以我删除了一些脚本标签
现在,标题中的脚本如下所示:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template ?>/jplayer/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
jQuery.noConflict();
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () { // When the jPlayer is ready to use
$(this).jPlayer("setMedia", { mp3: "http://localhost/Joomla-3.1.1/images/audio/The_Hellacopters_-_In_The_Sign_Of_The_Octopus.mp3" }); // Set the file which should be played
},
play: function() { // When the Play-Button is clicked
$(this).jPlayer("pauseOthers"); // To avoid multiple jPlayers playing together
},
swfPath: "jplayer/Jplayer.swf", // Set the File for flash (if html doesnt work this file is the source for the player)
supplied: "mp3", // Tell the jPlayer which file type (codec) should be used
cssSelectorAncestor: "#jp_container_1", // The buttons (links) in the div with this id will take effect on this jPlayer
});
$("#jquery_jplayer_2").jPlayer({
ready: function () { // When the jPlayer is ready to use
$(this).jPlayer("setMedia", { mp3: "http://localhost/Joomla-3.1.1/images/audio/3_Doors_Down_-_Believer.mp3" }); // Set the file which should be played
},
play: function() { // When the Play-Button is clicked
$(this).jPlayer("pauseOthers"); // To avoid multiple jPlayers playing together
},
swfPath: "jplayer/Jplayer.swf", // Set the File for flash (if html doesnt work this file is the source for the player)
supplied: "mp3", // Tell the jPlayer which file type (codec) should be used
cssSelectorAncestor: "#jp_container_2", // The buttons (links) in the div with this id will take effect on this jPlayer
});
});
//]]>
</script>
我将版本1.10.1放在jquery.jplayer.min.js之前和之后,它也在工作,因此它与版本无关。这是脚本的顺序。。。
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template ?>/jplayer/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
jQuery.noConflict();
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () { // When the jPlayer is ready to use
$(this).jPlayer("setMedia", { mp3: "http://localhost/Joomla-3.1.1/images/audio/The_Hellacopters_-_In_The_Sign_Of_The_Octopus.mp3" }); // Set the file which should be played
},
play: function() { // When the Play-Button is clicked
$(this).jPlayer("pauseOthers"); // To avoid multiple jPlayers playing together
},
swfPath: "jplayer/Jplayer.swf", // Set the File for flash (if html doesnt work this file is the source for the player)
supplied: "mp3", // Tell the jPlayer which file type (codec) should be used
cssSelectorAncestor: "#jp_container_1", // The buttons (links) in the div with this id will take effect on this jPlayer
});
$("#jquery_jplayer_2").jPlayer({
ready: function () { // When the jPlayer is ready to use
$(this).jPlayer("setMedia", { mp3: "http://localhost/Joomla-3.1.1/images/audio/3_Doors_Down_-_Believer.mp3" }); // Set the file which should be played
},
play: function() { // When the Play-Button is clicked
$(this).jPlayer("pauseOthers"); // To avoid multiple jPlayers playing together
},
swfPath: "jplayer/Jplayer.swf", // Set the File for flash (if html doesnt work this file is the source for the player)
supplied: "mp3", // Tell the jPlayer which file type (codec) should be used
cssSelectorAncestor: "#jp_container_2", // The buttons (links) in the div with this id will take effect on this jPlayer
});
});
//]]>
</script>