Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

vi-plugins/jquery-debouncedwidth

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jquery-debouncedwidth

The debouncedwidth event combines two performance critical features:

  • Reducing the amount of fired resize events
  • Disable resize events for height changes

The second feature is especially useful to ignore height changes in mobile browsers when the address bar hides or shows up while scrolling.

Usage, Demo

Just include jquery.debouncedwidth.min.js after jQuery and use the debouncedwidth event as a substitute for the ordinary resize event.

$(window).on('debouncedwidth', function(){
  // your code
});

To see a simple demo and comparison between the debouncedwidth and resize event open demo/index.html in your browser and start resizing (width and height) to see it in action.

Options

You can modify the threshold value globally once the script has been loaded:

// default value in ms: 150
$.event.special.debouncedwidth.threshold = 250;

License

About

Debounced width-only resizing event for jQuery

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%