See discussion on Hacker News. Built with D3 and TopoJSON.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mv: function(tp, h, nu, ind, ob) { // Collapse / Expand | |
var t = this; | |
if (t.ii[ind]) { | |
if (!nu) { | |
t.ii[ind].style.overflow = 'hidden'; | |
} | |
t.p.$(t.ii[ind]).animate({ | |
top: tp, | |
height: h | |
}, 800, null, function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question: | |
In the MM flickr example, the photos are displayed on load. However, I'd like to turn the whole flickr thing into a function that can be fired with a click on the page. | |
Original MM example (see changes/thought process in the next chunk): | |
var MM = com.modestmaps; | |
var provider = new MM.Layer(new MM.BlueMarbleProvider()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MB.layers = function(switcher, m, layers) { | |
$.each(layers, function(i, l) { | |
if (l.el) { | |
$('#' + l.el) | |
.click(function(e) { | |
e.preventDefault(); | |
//('#' + switcher + ' .layer').removeClass('active'); | |
$(this).addClass('active'); | |
MB.refresh(m, l); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new MB.layers('none', 'map', [ | |
{ | |
name: '', | |
id: 'jue.map-9izw3s28', | |
el: 'now', | |
layer: 1, | |
center: { | |
lat: -2, | |
lon: 17, | |
zoom: 3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new MB.layers('none', 'map', [ | |
{ | |
name: '', | |
id: 'jue.map-9izw3s28', | |
el: 'now', | |
layer: 1, | |
center: { | |
lat: -2, | |
lon: 17, | |
zoom: 3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case 'tooltips': | |
MM_map.interaction = wax.mm.interaction() | |
.map(MM_map) | |
.tilejson(t) | |
.on({on:function(o) | |
if (l.api=='http://a.tiles.mapbox.com/v3/djohnson.icc-situations,mapbox.world-borders-dark.jsonp') { | |
wax.tooltip() | |
.parent(MM_map.parent) | |
.events() | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(input).keydown(function (e) { | |
var value = $(this).val(); | |
if (value.length > 3) { | |
_.debounce(goGeo(value), 300); | |
} | |
var query = $(this).val(); | |
goGeo(query); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<head> | |
<link href='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.css' rel='stylesheet' /> | |
<!--[if lte IE 8]> | |
<link href='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.ie.css' rel='stylesheet' /> | |
<![endif]--> | |
<script src='//api.tiles.mapbox.com/mapbox.js/v1.3.1/mapbox.js'></script> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.html5rocks.com/en/tutorials/file/dndfiles/ | |
d3.select('svg') | |
.on('dragover', handleDragOver) | |
.on('drop', handleFileSelect) | |
; | |
function handleFileSelect() { | |
var event = d3.event | |
, files = event.dataTransfer.files // FileList object | |
, about = [] |
OlderNewer