Skip to content

Instantly share code, notes, and snippets.

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 cballou/c4a254d1cc56741f594f86ac08c39389 to your computer and use it in GitHub Desktop.
Save cballou/c4a254d1cc56741f594f86ac08c39389 to your computer and use it in GitHub Desktop.
// default lightbox options
$.fn.lightweight.defaults = {
height: 260,
width: 380,
color: '#fff',
bgColor: '#000',
bgOpacity: .5,
overlayColor: '#000',
overlayOpacity: .8,
fadeSpeed: 400,
borderRadius: 10,
closeClass: '.close'
};
// open the target element with ID "targetElement" (assumes it's already hidden by end user via style="display:none")
$('#targetElement').lightweight({
height: 400,
width: 400
});
// to manually close the lightbox
$('#targetElement').lightweight('close');
// an example of binding a button to close the lightbox
$('#targetElement a.close').on('click', function() {
$this.lightweight('close');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment