f / jquery.resizestop

Special Event for Resize Controls

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jQuery.resizestop (and resizestart)

Simple resize control special event plugin for jQuery.

resizestart event

This is how you bind resize start event:

jQuery(window).on('resizestart', function () {
	console.log('resize started!');
});

resizestop event

This is how you bind resize stop event:

jQuery(window).on('resizestop', function () {
	console.log('resize stopped!');
});

Defining the sensivity

The second parameter sets the sensivity of start/stop event. Lesser value is higher. Default is 300 for event start, 200 for event stop.

jQuery(window).on('resizestop', 100, function () {
	console.log('resize stopped!');
});

That will work more slowly.

jQuery(window).on('resizestop', 1000, function () {
	console.log('resize stopped!');
});

Catching the event type with event.type

jQuery(window).on('resizestop resizestart', function (e) {
	console.log(e.type); // e.type will return "resizestart" or "resizestop"
});

Currying

You can use resizestart and resizestop instead of using on binding.

jQuery(window).resizestart(function (e) {
	console.log('resize started');
});
jQuery(window).resizestop(function (e) {
	console.log('resize stopped');
});
jQuery(window).resizestop(1000, function (e) {
	console.log('resize stopped'); // will work 1000ms delayed.
});

License

License is CC0, means it is published to the public domain. You can use it for free wherever/whenever you want.

About

Special Event for Resize Controls