Skip to content

Instantly share code, notes, and snippets.

@plusjade
Created July 21, 2012 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plusjade/3157570 to your computer and use it in GitHub Desktop.
Save plusjade/3157570 to your computer and use it in GitHub Desktop.
lightbox.js customization for pragmatically setting options and initializing
<!--
In lightbox.js you need to remove the initialization function call at the bottom.
Lines highlighted here: https://github.com/lokesh/lightbox2/blob/master/js/lightbox.js#L345-349
This is what "starts" lightbox.
Place the initialization function at the bottom of one of your html layouts like so:
-->
<script>
$(function() {
var lightbox, options;
options = new LightboxOptions;
options.fileLoadingImage = 'images/loading.gif';
options.fileCloseImage = 'images/close.png';
return lightbox = new Lightbox(options);
});
</script>
<!--
Once it's in the layouts.html file, you are free to use the mustache syntax to replace the image paths:
-->
<script>
$(function() {
var lightbox, options;
options = new LightboxOptions;
options.fileLoadingImage = '{{urls.media}}/loading.gif';
options.fileCloseImage = '{{urls.media}}/close.png';
return lightbox = new Lightbox(options);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment