我与"Stratus 2“网络播放器在我的网站上有麻烦。我已经下载并将"Jquery“放到公用文件夹中。它被命名为jquery.js
然后,我在end body标记之前附加了以下代码。
<html class="html">
<head>
<script type="text/javascript">
if(typeof Muse == "undefined") window.Muse = {}; window.Muse.assets = {"required":["jquery-1.8.3.min.js", "museutils.js", "jquery.scrolleffects.js", "jquery.musepolyfill.bgsize.js", "jquery.watch.js", "webpro.js", "musewpslideshow.js", "jquery.museoverlay.js", "touchswipe.js", "index.css"], "outOfDate":[]};
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://stratus.sc/stratus.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.stratus({
download: false,
align: 'top',
user:false,
color:'E8C58B',
links: 'https://soundcloud.com/man-in-a-loft-downtown/sets/the-latest'
});
});
</script>我也尝试过在头部标签中输入代码。玩家没有出现。有什么想法吗?
我在控制台上看到了这个错误
$.stratus is not a function但是我看到stratus.js文件确实加载了。
全头代码:http://shrib.com/aA2V6JqX
请看一看,并相应编辑。
发布于 2014-08-14 12:59:27
我现在正在听你的音乐播放器后,在你的网站乱搞,听起来不错!
您正在加载两个不同版本的jQuery。
// version 1.8.3
window.Muse.assets = {"required":["jquery-1.8.3.min.js", "museutils.js", "jquery.scrolleffects.js", "jquery.musepolyfill.bgsize.js", "jquery.watch.js", "webpro.js", "musewpslideshow.js", "jquery.museoverlay.js", "touchswipe.js", "index.css"], "outOfDate":[]};和1.7.2
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>如果您检查生成的HTML,您将看到Muse在加载stratus插件之后正在加载jQuery,因此会覆盖它。
一个不好的,但有效的解决方案是等到jQuery的缪斯负载加载,但我不知道有一个简单的方法来检测,所以你可以给它一个繁忙的等待。删除加载1.7.2的行,并将初始化脚本更改为
function checkjQuery() {
if (window.jQuery) {
$.getScript( "http://stratus.sc/stratus.js", function() {
$.stratus({
download: false,
align: 'top',
user:false,
color:'E8C58B',
links: 'https://soundcloud.com/man-in-a-loft-downtown/sets/the-latest'
});
});
} else {
setTimeout(checkjQuery, 10);
}
}
checkjQuery();发布于 2014-08-14 13:05:55
将jQuery版本升级到1.7或更高版本,并更改$.stratus(中的$('body').stratus(
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://stratus.sc/stratus.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('body').stratus({
links: 'https://soundcloud.com/iagoofficial/iago-hold-back'
});
});
</script>
</head>
<body>
</body>
</html>https://stackoverflow.com/questions/25308319
复制相似问题