local-host 2017-11-06 08:51 采纳率: 100%
浏览 18

未定义Vimeo

I have this errors in console.log.

jQuery.Deferred exception: Vimeo is not defined ReferenceError: Vimeo is not defined
    at HTMLDocument.<anonymous> (http://unisoft.local/js/scripts.min.js:1:18238)
    at j (http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:29999)
    at k (http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:30313)

Uncaught ReferenceError: Vimeo is not defined
    at HTMLDocument.<anonymous> (scripts.min.js:1)
    at j (jquery.min.js:2)
    at k (jquery.min.js:2)

The code is: js file:

var vimeoBanner = $('#vimeo-banner');

    if (vimeoBanner[0]) {
        var vimeoPlayer = new Vimeo.Player(vimeoBanner[0]);
        vimeoPlayer.setVolume(0.2);
        vimeoPlayer.setLoop(false);
        if (firstVisit) {
            vimeoPlayer.play();
        }
    }

and html:

<div class="video-banner">
    <div class="video-banner__video">
        <iframe id="vimeo-banner" src="https://player.vimeo.com/video/217894047?color=02b4b6" width="640" height="360"
                allowfullscreen></iframe>
    </div>

Can someone help me please, I tried already to change the order of script files and it didn't work? Thanks.

  • 写回答

1条回答 默认 最新

  • weixin_33720956 2018-07-13 17:58
    关注

    The variable/class is being used before it is declared. This library needs to be completely loaded first. Using the class inside a function that waits for the page to finish loading and putting the reference to the library in the header should do the trick.

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测