jQuery Tutorial Tutorials - jQuery .resize() method

jQuery .resize() method

The .resize(callback) method in jQuery is used to define the action when "resize" event occure or trigger the "resize" event on an element.

jQuery .resize() method Syntax

.resize(handler)
.resize([eventData],handler)
.resize()

.resize(handler) .resize([eventData],handler) are equivalent to .on('resize', handler([eventData]))

and

resize() is equivalent to .trigger( "resize" )

jQuery .resize() method Example

example

Get the new size of window while it is resized

$(window).resize(function(){
  $( "#log" ).html( "The window's width is: "+$( window ).width()+ ", height is: " + $( window ).height() );
});

Try now

Date:2019-08-28 10:32:23 From:www.Lautturi.com author:Lautturi