froogaloop:未定义$ [英] froogaloop: $ is not defined

查看:143
本文介绍了froogaloop:未定义$的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用froogaloop库嵌入Vimeo视频,但遇到此错误.我直接从Vimeo的网站上获取了所有代码( https://developer.vimeo.com/player/js -api ).

I'm using the froogaloop library for embedding Vimeo videos and I came across this error. I took all the code right from Vimeo's site (https://developer.vimeo.com/player/js-api).

我已经在代码的前面链接了Javascript库,然后在执行下面的代码时.

I have linked the Javascript library earlier in the code then when the code below is executed.

有什么想法吗?

Web控制台错误:"ReferenceError:未定义$"

Web Console Error: "ReferenceError: $ is not defined"

JavaScript代码:

Javascript code:

$(function() {
var iframe = $('#player1')[0];
var player = $f(iframe);
var status = $('.status');

// When the player is ready, add listeners for pause, finish, and playProgress
player.addEvent('ready', function() {
    status.text('ready');

    player.addEvent('pause', onPause);
    player.addEvent('finish', onFinish);
    player.addEvent('playProgress', onPlayProgress);
});

// Call the API when a button is pressed
$('button').bind('click', function() {
    player.api($(this).text().toLowerCase());
});

推荐答案

您是在此代码之后加载jQuery还是不在.您需要在此脚本之前包含jQuery.

You are either loading jQuery after this code or not at. You need to include jQuery before this script.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

这篇关于froogaloop:未定义$的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆