diff --git a/jquery.sticky.js b/jquery.sticky.js index 6ba019a..b82e195 100644 --- a/jquery.sticky.js +++ b/jquery.sticky.js @@ -10,7 +10,18 @@ // It will only set the 'top' and 'position' of your element, you // might need to adjust the width in some cases. -(function($) { +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === 'object' && module.exports) { + // Node/CommonJS + module.exports = factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { var slice = Array.prototype.slice; // save ref to original slice() var splice = Array.prototype.splice; // save ref to original slice() @@ -212,4 +223,4 @@ $(function() { setTimeout(scroller, 0); }); -})(jQuery); +}));