Skip to content

Instantly share code, notes, and snippets.

jQuery(document).ready(function($) {
$( document ).tooltip({
items: "[data-tooltip]",
content: function() {
var element = $( this );
var text = element.text();
var url = element.attr('data-tooltip');
return "<img class='map' alt='" + text +
"' src='" + url + "'>";
}
<html lang="en">
<head>
<meta charset="utf-8">
<title>Your title here</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
$(function() {
$( document ).tooltip({
@aleszu
aleszu / gist:2d7c26eb150540127bf3
Created May 4, 2015 21:45
HTML with jQuery UI
Say, I'm writing a story set in Mexico City and I want to show you a photo of its <span style="background-color: #ffff66;" data-tooltip="http://upload.wikimedia.org/wikipedia/commons/9/98/Mexico_City_Zocalo_Cathedral.jpg">main square</span> without moving away from my narrative layout.
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Storybench - A cookbook for digital storytellers" />
<meta property="og:description" content="The art and science of digital storytelling from the Media Innovation program at Northeastern University and Esquire magazine." />
<meta property="og:url" content="http://www.storybench.org" />
<meta property="og:site_name" content="Storybench" />
<meta property="article:publisher" content="https://www.facebook.com/storybench" />
<meta property="og:image" content="http://www.storybench.org/wp-content/uploads/2014/12/storybenchlogo8.png" />
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="article" />
<meta property="og:title" content="How AlJazeera plans its interactive storytelling projects - Storybench" />
<meta property="og:description" content="AlJazeera has built several long-form storytelling projects that have infused investigative journalism with digital technology and allowed users to experience stories in engaging ways. See The War Across the River about refugees from the Central African Republic, or Freedom Denied, an interactive exploration of what happens to some Palestinians after they&#8217;re arrested by the Israeli military. Palestine Remix, one of the largest interactives [...]" />
<meta property="og:url" content="http://www.storybench.org/how-aljazeera-plans-its-interactive-storytelling-projects/" />
<meta property="og:site_name" content="Storybench" />
<meta property="article:publisher" content="https://www.facebook.com/storybench" />
<meta property="og:image" content="http://www.storybench.org/
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:description" content="AlJazeera has built several long-form storytelling projects that have infused investigative journalism with digital technology and allowed users to experience stories in engaging ways. See The War Across the River about refugees from the Central African Republic, or Freedom Denied, an interactive exploration of what happens to some Palestinians after they&#8217;re arrested by the Israeli military. Palestine Remix, one of the largest interactives [...]"/>
<meta name="twitter:title" content="How AlJazeera plans its interactive storytelling projects - Storybench"/>
<meta name="twitter:site" content="@storybench"/>
<meta name="twitter:domain" content="Storybench"/>
<meta name="twitter:image:src" content="http://www.storybench.org/wp-content/uploads/2015/05/interaljazeera.jpg"/>
<meta name="twitter:creator" content="@storybench"/>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
var marginbottom = 0, chartwidth = 90, chartheight = 30; //3D units
var xscale = d3.scale.linear().range([0, chartwidth]),
yscale = d3.scale.linear().range([0, chartheight]);
xscale.domain([0, data.length - 1]);
yscale.domain([0, d3.max(data, function(d){ return d.all; })]);
var columnwidth = (chartwidth / data.length);
columnwidth -= columnwidth * 0.1;