diff --git a/README.markdown b/README.markdown index 05ce48d..0da3c9e 100644 --- a/README.markdown +++ b/README.markdown @@ -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. @@ -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(); diff --git a/jquery.lightbox_me.js b/jquery.lightbox_me.js index 548e8eb..cf5896d 100644 --- a/jquery.lightbox_me.js +++ b/jquery.lightbox_me.js @@ -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. @@ -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) { @@ -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); @@ -231,4 +241,4 @@ modalCSS: {top: '40px'}, overlayCSS: {background: 'black', opacity: .3} } -})(jQuery); +}))