A simple framework for executi

onresize.js

A simple framework for executing JavaScript functions when the browser window is resized.

Why onresize.js? Simple usage. No media queries. No complicated options. Just queue functions to run when the window resizes. Functions run only once per resize with built-in debounce delay. No dependencies. It's tiny (777 bytes minified). How to use:

// Create instance of OnResize object. var oR = new OnResize(); // Optionally set debounce delay in milliseconds. Default is 250. oR.delay = 300; // Add your functions to the list of behaviors to be executed when the window resizes. // The first argument is the current browser width. var myFunction = function(width) { alert('The window width is ' + width + 'px'); } oR.add(myFunction); // Retrieve the current window width at anytime. windowWidth = oR.width;

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。