Skip to content

jQuery plugin for requestAnimationFrame based event throttling

License

Notifications You must be signed in to change notification settings

wagich/jquery-throttle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jquery-throttle

jQuery plugin for requestAnimationFrame based event throttling

Availability

bower install jquery-throttle

Installation

<script src="bower_components/requestAnimationFrame.js/requestAnimationFrame.js"></script>
<script src="bower_components/jquery-throttle/jquery.throttle.js"></script>

Usage

Use in the same way as you would use jQuery's .on() and .off():

$(window).throttle("resize", function() {
    // your code here
});
$(window).removeThrottle("resize");

If you're developing a plugin, check if jquery.throttle is available, and fallback to jQuery.on().

if (typeof($(window).throttle) == "function") {
    $(window).throttle("resize", function() {
        // your code here
    });
}
else {
    $(window).on("resize", onResize);
}

About

jQuery plugin for requestAnimationFrame based event throttling

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%