// Generated by CoffeeScript 1.6.2 /* Sticky Elements Shortcut for jQuery Waypoints - v2.0.3 Copyright (c) 2011-2013 Caleb Troughton Dual licensed under the MIT license and GPL license. https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt */ (function() { (function(root, factory) { if (typeof define === 'function' && define.amd) { return define(['jquery', 'waypoints'], factory); } else { return factory(root.jQuery); } })(this, function($) { var defaults, wrap; defaults = { wrapper: '
', stuckClass: 'stuck' }; wrap = function($elements, options) { $elements.wrap(options.wrapper); return $elements.parent(); }; $.waypoints('extendFn', 'sticky', function(opt) { var $wrap, options, originalHandler; options = $.extend({}, $.fn.waypoint.defaults, defaults, opt); $wrap = wrap(this, options); originalHandler = options.handler; options.handler = function(direction) { var $sticky, shouldBeStuck; $sticky = $(this).children(':first'); shouldBeStuck = direction === 'down' || direction === 'right'; $sticky.toggleClass(options.stuckClass, shouldBeStuck); $wrap.height(shouldBeStuck ? $sticky.outerHeight() : ''); if (originalHandler != null) { return originalHandler.call(this, direction); } }; $wrap.waypoint(options); return this.data('stuckClass', options.stuckClass); }); return $.waypoints('extendFn', 'unsticky', function() { this.parent().waypoint('destroy'); this.unwrap(); return this.removeClass(this.data('stuckClass')); }); }); }).call(this);