Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

This is just a shorter way to conditionally throttle the callback... #1

Merged
merged 1 commit into from

2 participants

Mukunda Modell Aimee Ault
Mukunda Modell

though it's not much shorter it feels cleaner to me...

Aimee Ault aimee-ault merged commit 55b7e87 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 24, 2011
  1. Mukunda Modell
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 9 deletions.
  1. +7 −9 jquery.viewport.js
16 jquery.viewport.js
View
@@ -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 = {
Something went wrong with that request. Please try again.