Using jQuery with Hype

Why use jQuery with Hype? JQuery provides commands for fade-ins, fade-outs, and other animated effects. So, you can bypass much of the clumsy handiwork in Hype creating animations, and dealing with keyframes and timelines by using jQuery. But you can still use Hype to layout your design.

JQuery is a popular, and powerful, JavaScript library that makes it easy to select elements on an HTML document and create animations, effects, and transitions. JQuery isn’t a separate language–it’s simply a set of well-written JavaScript code that groups together commands to make it easier to do things. For example, if you were to write (hypothetical) code in JavaScript to open a door, you might have to write several lines of instruction:
1. Step up to the door
2. Grab the handle
3. Turn clockwise
4. Push

In jQuery, all of these commands might be grouped together in a single function called, Open Door. This saves you a lot of time and effort. Follow these steps to create a simple example that uses jQuery to fade out an object.

1. In Hype 1.6.0, edit the Head section of the HTML document. Select the Document inspector tab, and click on the “Edit Head HTML…” button.

2. In between the <head> and </head> tags, add this script:

<script src=""></script>

The <script> tag tells the browser to download the jQuery library from Google, which hosts the code.

3. Return to the Hype stage. Select the element you want to animate with jQuery. In the Identity inspector (the far right tab), provide a Unique Element ID. For this example, add an image and give it the unique name, obamaheadshot. It may say “Automatically Generated”, but put your cursor inside the field to enter your own.

4. Create an interaction that will trigger a jQuery effect. In this example, assign an On Mouse Click event to the image. For Action, choose “Run JavaScript…”, and for Function: choose “New Function”. An untitledFunction() appears as your new function.

5. In the untitledFunction() page that appears, you can add your own JavaScript (or jQuery) code. In between the curly braces of the function, add this statement.



The dollar sign, parentheses, and quotation marks, $(“”), is the jQuery syntax to select something in the HTML document. The pound sign is a CSS way of indicating that the thing is a unique element. So, the statement selects the item marked as obamaheadshot, and applies the fadeOut() command to it. The fadeOut() command makes it fade from 100% opacity to 0% opacity.

6. Try the entire interactivity out here, or below. Click on the image of Obama. The photo fades out using a single jQuery command, with no timeline animation necessary.

Download the completed Hype file. Learn about other jQuery effects. Try starting with these:


A word about Dropbox: Although Hype makes it easy to publish directly to your Dropbox public folder, Dropbox is really meant for storage and file sharing, and not for web hosting. Performance isn’t the greatest from Dropbox, so upload your published files to your own server.


Adding Video to Tumult Hype

You can easily add video to a Tumult Hype project by copying and pasting a video’s iframe code into Hype’s HTML widget. Follow these steps:

1. Find your video on a video sharing site, such as YouTube, and click the Share button, and then the Embed button to copy the iframe code.

2. In Hype, create a new HTML Widget.

3. Double-click the HTML Widget, or click on the Pencil icon at the bottom edge. Paste the iframe code that you copied from YouTube into the text box.

4. Hype automatically pulls the video content from YouTube and displays it in the HTML widget. You can resize the HTML Widget so that it fits the dimensions of your video. Drag the bottom right corner to enlarge the width or height.

5. Click the Preview button at the top right corner of the Hype interface to preview your embedded video in your project.

Now, if you have several scenes, there is a bug that causes the audio from your video to continue even after you switch to a different scene. The solution is to add a little JavaScript to kill the audio if your reader leaves the current scene. Here’s how to add that script:

1. Click on the “Scene Inspector” tab on the panel on the far right of the Hype interface. This panel allows you to add interactivity to the general scene (and not individual buttons).

2. For the On Scene Unload (the very bottom event), choose “Run Javascript” and for Function, choose “New function”. This makes Hype execute a JavaScript function whenever the reader leaves this particular scene.

3. Hype automatically adds some JavaScript code in a new window.

4. Add this line of code in between the opening and closing curly braces of the script:

document.getElementById("uniqueIDhere").innerHTML = ' ';

Hype identifies a particular element on the stage, called “uniqueIDhere”, and makes the contents blank. That will kill the contents of your HTML widget, and consequently, the audio from the video. Those last punctuation marks are a pair of single straight quotation marks and a semi-colon. When you return to the scene, the video will reload into the HTML widget.

5. Last step…you have to identify your HTML widget on the scene with the unique ID that you referenced in Javascript. Select your scene where your video is embedded, and click on the video. Choose the last tab called the “Identity inspector” on the panel on the far right. Enter the unique ID in the last field. In this example, since the code in step 4 has “uniqueIDhere”, I entered uniqueIDhere. It’s best to choose a name that makes sense to you.

6. All done!

Google Fusion Tables Layer Wizard Example

Using Google Fusion Tables Layer Wizard

Combine two different Google Fusion maps. This one combines a map with shapes colored to correspond to number of English Language Learner students in each school district, and another map with points for each public school.

Other options you can configure are adding a search field to query a specific column in your table (this one searches school name), and changing the appearance and features on your map.

Use the iframe code to embed the URL to your combined map.

Oct 24

John Keefe, who leads the data news team at WNYC, will come talk about some of his data projects. Great posts to dive in with include:

+ Mapping campaign donations against districts
+ More campaign donations
+ Coastal Evacuation Map
+ AP Election Data
+ Live Election Data


Revise your pitch and add a wireframe/storyboard that reflects the planned layout. We use wireframe and storyboards synonymously here. We’re looking for a simple sketch (on paper, in Word, or PowerPoint, or any number of online storyboarding tools) that tells us how you intend to integrate your visualizations, words, and navigation elements.

A storyboard organizes your content conceptually and spatially. Use simple boxes to represent where your different elements are positioned in a design, and how the user navigates through the content. Here are Mark Luckie’s thoughts on sketching/storyboarding, with examples, from 10,000 Words a few year’s back.


Your assignment is to re-design one of three existing data visualizations listed below. Identify the visualization and/or design weaknesses and explain your improvements.

We’re not interested in a perfect remapping of the data, but just your overall approach of how your data viz would appear with the same set of data. Your sketch will be just an approximate of the existing data.

Deliverable: sketch on paper, preferably scanned to be submitted on WordPress and for potential presentation, but we understand if you do not have easy access to a scanner, so we will accept the hard copy.

The Atlantic: Classified Documents
Good: Teacher Salaries
National Geographic: High School Foreign Exchange

(Thanks to Jeff Heer of Stanford for design examples)