$(window).resize(function() example Example: detect resize window javascript window.addEventListener('resize', functionName);