Skip to content

Instantly share code, notes, and snippets.

@rwbaker
Created June 21, 2011 11:01
Show Gist options
  • Save rwbaker/1037626 to your computer and use it in GitHub Desktop.
Save rwbaker/1037626 to your computer and use it in GitHub Desktop.
Ajax Load Colorbox Assets
//Add colorbox style
var url = '../css/colorbox.css';
if ( document.createStyleSheet ) {
//http://msdn.microsoft.com/en-us/library/ms531194%28VS.85%29.aspx
document.createStyleSheet(url,1);
} else {
jQuery.root.find('head').append('<link rel="stylesheet" media="all" href="'+url+'">');
};
//Load colorbox script
$.getScript('../js/jquery.colorbox-min.js', function(){
jQuery.root.find('.enlarge-photo').colorbox();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment