Popcorn.js Website and JavaScript commands

Hey, so Popcorn.js has two new commands.

website command, which will display a website in the targeted div, and a JavaScript command, which takes two parameters, a start function, which is to be fired on the events in time, and a stop, which is fired on the events out.

Example of the website command is:
<webpage in=”00:04:00:08″ out=”00:04:19:00″ target=”iframes” src=”www.google.ca” width=”100%” height=”100%”></webpage>

I just noticed it should probably be a: <webpage />

The script command is simple:
<script in=”1″ out=”10″ start=”customJS.start” stop=”customJS.stop”/>

    var customJS = (function() {
      var interval;
      var content = document.getElementById("content");
      
      function work() {
        var item = document.createElement("p");
        item.innerHTML = "working...";
        content.appendChild(item);
      }

      return {
        start: function() {
          var item = document.createElement("p");
          item.innerHTML = "starting...";
          content.appendChild(item);
          interval = setInterval(work, 1000);
        },
        stop: function() {
          var item = document.createElement("p");
          item.innerHTML = "done!";
          content.appendChild(item);
          clearInterval(interval);
        }
      };
    })();

Using the above as the function to call.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: