Skip to content

Instantly share code, notes, and snippets.

@thesmith
Created July 12, 2010 22:02
Show Gist options
  • Save thesmith/473144 to your computer and use it in GitHub Desktop.
Save thesmith/473144 to your computer and use it in GitHub Desktop.
$.getJSON("http://atlasapi.org/2.0/brands.json?playlist.uri=http://www.channel4.com/programmes/4od/highlights&callback=?",
function(data){
console.log(data);
}
);
var addItem = function(item, i) {
var left = (i*200) % $("body").width();
var top = Math.floor(Math.random() * 500);
$("<img/>").css({ position: 'absolute', left: left, top: top, opacity: 0, width: 100}).attr("src", item.thumbnail).appendTo("body").animate({
opacity: 1,
width: '200'
}, 4000, function() {
$(this).animate({
opacity: 0,
}, 3000, function() {
$(this).remove();
});
});
}
$.getJSON("http://api.uriplay.org/2.0/brands.json?playlist.uri=http://www.channel4.com/programmes/4od/highlights&callback=?",
function(data) {
$.each(data.playlists, function(i,playlist) {
setTimeout(function() { addItem(playlist.items[0], i); }, i * 200);
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment