Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for AMD and CommonJS modules #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# jquery.lightbox_me.js #
**version 2.2**
**version 2.5**

Have you ever had a DOM element that you wanted lightboxed, but didn't want all the fanciness of all the lightbox-related plug-ins out there? Lightbox_me is for you.

Expand All @@ -15,6 +15,8 @@ Lightbox_me is a jQuery plugin and requires jQuery to be included in order to wo

Include both jQuery and the lightbox_me JavaScript file before calling the plugin in your JavaScript.

Alternatively, you can use AMD or CommonJS module loader.

Invoke the lightbox by calling the plugin on a jQuery object:

$(dom).lightbox_me();
Expand Down
20 changes: 15 additions & 5 deletions jquery.lightbox_me.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* $ lightbox_me
* By: Buck Wilson
* Version : 2.4
* Version : 2.5
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,8 +16,18 @@
* limitations under the License.
*/


(function($) {
(function(factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function($) {

$.fn.lightbox_me = function(options) {

Expand Down Expand Up @@ -131,7 +141,7 @@
$self.undelegate(opts.closeSelector, "click");
$self.unbind('close', closeLightbox);
$self.unbind('repositon', setSelfPosition);

$(window).unbind('resize', setOverlayHeight);
$(window).unbind('resize', setSelfPosition);
$(window).unbind('scroll', setSelfPosition);
Expand Down Expand Up @@ -231,4 +241,4 @@
modalCSS: {top: '40px'},
overlayCSS: {background: 'black', opacity: .3}
}
})(jQuery);
}))