Skip to content

Commit

Permalink
shorter then the if..else blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
20after4 committed May 24, 2011
1 parent b6dcb5b commit 6dd2b1b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions jquery.viewport.js
Expand Up @@ -27,15 +27,13 @@
}
});
}
if(jQuery.throttle) {
$win.scroll($.throttle(options.delimitRate, inViewPort))
.resize($.throttle(options.delimitRate, inViewPort))
.click($.throttle(options.delimitRate, inViewPort));
} else {
$win.scroll(inViewPort)
.resize(inViewPort)
.click(inViewPort);
}
var callback = $.throttle
? $.throttle(options.delimitRate, inViewPort)
: inViewPort;

$win.scroll(callback)
.resize(callback)
.click(callback);
};

$.fn.viewPort.defaults = {
Expand Down

0 comments on commit 6dd2b1b

Please sign in to comment.