jQuery window on resize

Run code on resize window:

$(window).bind("resize", function(){
	// resizing code
});

Run code on resize window with 100 milliseconds interval:

var resizeTimer = null;
$(window).bind('resize', function() {
	if (resizeTimer) clearTimeout(resizeTimer);
	resizeTimer = setTimeout(function(){
		// resizing code
	}, 100); // adding 100 milliseconds interval for avoiding jumps
});
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">