admin管理员组文章数量:1391969
used the api to add a button that plays 1 vimeo video on a page.
I added the Froogaloop plugin into my plugins.js file and am calling out to it on my main.js file.
Here's my code
ready = function(player_id) {
var playButton, player;
player = $f(player_id);
playButton = $('#playButton');
return playButton.on('click', function(e) {
e.preventDefault();
player.api('play');
});
};
$f(document.getElementById('player')).addEvent('ready', ready);
The problem I'm having is that any script after this will not run. The error JSHint gives me is '$f' is not defined
I've tried defining ($f = ''
)this, but it simply breaks the functionality (which makes sense why that would break it). Has anyone run into this issue before? Do you know of a fix?
Also note that the above code block works. It just has to be the very last thing in my main js file or else everything after it would break. It also won't pass JSHint. I get two '$f' is not defined.
errors.
Any help would be greatly appreciated.
Thnx!
used the api to add a button that plays 1 vimeo video on a page.
I added the Froogaloop plugin into my plugins.js file and am calling out to it on my main.js file.
Here's my code
ready = function(player_id) {
var playButton, player;
player = $f(player_id);
playButton = $('#playButton');
return playButton.on('click', function(e) {
e.preventDefault();
player.api('play');
});
};
$f(document.getElementById('player')).addEvent('ready', ready);
The problem I'm having is that any script after this will not run. The error JSHint gives me is '$f' is not defined
I've tried defining ($f = ''
)this, but it simply breaks the functionality (which makes sense why that would break it). Has anyone run into this issue before? Do you know of a fix?
Also note that the above code block works. It just has to be the very last thing in my main js file or else everything after it would break. It also won't pass JSHint. I get two '$f' is not defined.
errors.
Any help would be greatly appreciated.
Thnx!
Share Improve this question asked Mar 7, 2013 at 19:15 DavidVIIDavidVII 2,2832 gold badges23 silver badges29 bronze badges 1- Does this help? – PHearst Commented Apr 9, 2013 at 11:38
4 Answers
Reset to default 1I was having this problem because I was including my script before including froogaloop.js.
It seems that $f is defined on that js.
If the error is just with JSHint, you can add the following ment to the top of the file to suppress the warning:
/*global $f:false */
You must connect the library
<script src="http://a.vimeocdn./js/froogaloop2.min.js"></script>
As drcord pointed out in his answer to this similar question:
You are either loading jQuery after this code or not at. You need to include jQuery before this script.
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.4/jquery.min.js></script>
本文标签: javascriptVimeo APIFroogaloop f is not definedStack Overflow
版权声明:本文标题:javascript - Vimeo API - Froogaloop. $f is not defined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744733758a2622199.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论