Skip to content

Instantly share code, notes, and snippets.

@kolobus
Created November 7, 2012 20:32
Show Gist options
  • Save kolobus/4034221 to your computer and use it in GitHub Desktop.
Save kolobus/4034221 to your computer and use it in GitHub Desktop.
Snip autoload on jquery
if ($('div.snip').length) {
$('head').append($('<link rel="stylesheet" href="/i/snipplr.css" type="text/css" media="screen" />'));
$('div.snip').each( function() {
$.getJSON('/i/snipplr.php?id='+$(this).attr('id'), function(snip) {
$('div.snip#'+snip.id).html(snip.source+'<p>View this snippet <a href="'+snip.link+'" target="_blank">on Snipplr</a></p>');
$('div.snip#'+snip.id+' li:odd').css("background-color", "#e0e0e0");
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment