Skip to content

Instantly share code, notes, and snippets.

@aloncarmel
aloncarmel / randombg.js
Created August 20, 2013 13:35
Grab a random background from unsplash.com and apply to a div.
function GetRandomBackground()
{
var url = 'http://unsplash.com/rss';
$.ajax({
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
async: false,
jsonpCallback: 'jsonCallback',
contentType: "application/json",