Tip: Click lines to highlight, hold ctrl/cmd to multi-select
http://codedumper.com/azoku (11-Feb @ 19:15)
Syntax Highlighted Code
- $.fn.fuckingAwesome = function( options ) {
- var self = this,
- win = $( window );
- options = $.extend( { min: 0 }, options );
- if ( options.min === "auto" ) { options.min = self.offset().top; }
- win.bind( "scroll resize", function() {
- var windowTop = win.scrollTop(),
- currentTop = self.offset().top;
- if ( windowTop > options.min || currentTop > options.min ) {
- var top = Math.max( windowTop, options.min );
- if ( options.max ) {
- top = Math.min( top, $.isFunction(options.max) ? options.max() : options.max );
- }
- self.stop().animate({
- top: top
- }, 200);
- }
- });
- };
Plain Code
$.fn.fuckingAwesome = function( options ) {
var self = this,
win = $( window );
options = $.extend( { min: 0 }, options );
if ( options.min === "auto" ) { options.min = self.offset().top; }
win.bind( "scroll resize", function() {
var windowTop = win.scrollTop(),
currentTop = self.offset().top;
if ( windowTop > options.min || currentTop > options.min ) {
var top = Math.max( windowTop, options.min );
if ( options.max ) {
top = Math.min( top, $.isFunction(options.max) ? options.max() : options.max );
}
self.stop().animate({
top: top
}, 200);
}
});
};