2

So it works perfectly when it's inline between tags, but how can I put this in an external js file and have it run? I copied it verbatim and it won't work. What's the issue?

edit: you can see the tutorial I'm working off of here: http://popcornjs.org/popcorn-101

code:

// ensure the web page (DOM) has loaded
document.addEventListener("DOMContentLoaded", function () {

 // Create a popcorn instance by calling Popcorn("#id-of-my-video")
 var pop_Stephen = Popcorn("#vid_Stephen");

 // add a footnote at 2 seconds, and remove it at 6 seconds
 pop_Stephen.footnote({
   start: 2,
   end: 6,
   text: "Pop!",
   target: "pop"
 });

 // play the video right away
 // pop_Stephen.play();

}, false);

edit: OK it seems that it just doesn't work within CODA2, which is a bummer. Any idea why this is?

4

2 回答 2

0

I'm betting that your <script /> tags have you loading your external file before the Popcorn library.

Make sure you load <script src="http://popcornjs.org/code/dist/popcorn-complete.min.js"></script> before your external file.

于 2012-11-03T23:01:19.600 回答
0

也许使用实用方法 Popcorn.getScript?

http://popcornjs.org/popcorn-docs/utility-methods/#Popcorn.getScript

从网站:

Popcorn.getScript("yourscript.js");
于 2015-01-22T13:44:07.150 回答