-
-
Save svenoaks/fd204fb4cf17cda5ed45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Javascript to emulate media queries with events and HTML class toggling | |
* to avoid duplication, conflict & waste when implemented via | |
* native CSS implementation + JS feature dependency. | |
* | |
* Depends on jQuery and Cowboy's throttle / debounce plugin: | |
* https://github.com/cowboy/jquery-throttle-debounce | |
*/ | |
(function(){ | |
var options = { | |
rateLimitMethod : ['debounce','throttle'] | |
}; | |
var defaults = { | |
events : 'resize', | |
rateLimitMethod : 'throttle', | |
rateLimitDelay : 60 | |
}; | |
var config = $.extend({}, defaults); | |
$(window).on(events, $[rateLimitMethod](rateLimitDelay), fn); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment