首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Stratus 2、jQuery和Adobe

Stratus 2、jQuery和Adobe
EN

Stack Overflow用户
提问于 2014-08-14 12:41:09
回答 2查看 3.8K关注 0票数 1

我与"Stratus 2“网络播放器在我的网站上有麻烦。我已经下载并将"Jquery“放到公用文件夹中。它被命名为jquery.js

然后,我在end body标记之前附加了以下代码。

代码语言:javascript
复制
<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>

我也尝试过在头部标签中输入代码。玩家没有出现。有什么想法吗?

我在控制台上看到了这个错误

代码语言:javascript
复制
$.stratus is not a function

但是我看到stratus.js文件确实加载了。

全头代码:http://shrib.com/aA2V6JqX

请看一看,并相应编辑。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-08-14 12:59:27

我现在正在听你的音乐播放器后,在你的网站乱搞,听起来不错!

您正在加载两个不同版本的jQuery。

代码语言:javascript
复制
// 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

代码语言:javascript
复制
<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的行,并将初始化脚本更改为

代码语言:javascript
复制
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();
票数 2
EN

Stack Overflow用户

发布于 2014-08-14 13:05:55

将jQuery版本升级到1.7或更高版本,并更改$.stratus(中的$('body').stratus(

代码语言:javascript
复制
<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>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25308319

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档