Skip to content

Instantly share code, notes, and snippets.

@jueyang
jueyang / QW expand
Created Apr 24, 2012
from quitewrite
View QW expand
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() {
@jueyang
jueyang / Flickr MM example
Created Apr 25, 2012
display image from flickr non-geographically and geographically
View Flickr MM example
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());
@jueyang
jueyang / question MB.layers
Created May 4, 2012
How do i make the switcher and the in-text link independent from each other?
View question MB.layers
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);
});
@jueyang
jueyang / MB.layers
Created May 10, 2012
multiple layer switchers?
View MB.layers
new MB.layers('none', 'map', [
{
name: '',
id: 'jue.map-9izw3s28',
el: 'now',
layer: 1,
center: {
lat: -2,
lon: 17,
zoom: 3,
@jueyang
jueyang / MB.layers
Created May 10, 2012
multiple layer switchers?
View MB.layers
new MB.layers('none', 'map', [
{
name: '',
id: 'jue.map-9izw3s28',
el: 'now',
layer: 1,
center: {
lat: -2,
lon: 17,
zoom: 3,
@jueyang
jueyang / index
Created May 29, 2012
when to use tooltip
View index
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()
);
View geocoder.js
$(input).keydown(function (e) {
var value = $(this).val();
if (value.length > 3) {
_.debounce(goGeo(value), 300);
}
var query = $(this).val();
goGeo(query);
});
View index.html
<!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>
View dnd.js
// 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 = []