Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where's the width() function in jQuery source?

Where's the width() function in jQuery source?

like image 410
The Student Avatar asked Feb 14 '11 18:02

The Student


People also ask

How to get the width in jQuery?

innerWidth() - Returns the width of an element (includes padding) innerHeight() - Returns the height of an element (includes padding) outerWidth() - Returns the width of an element (includes padding and border). outerHeight() - Returns the height of an element (includes padding and border).

Which jQuery method is used to get or set the width of an HTML element?

css() is a method and width is a property name. It is one of the methods of jQuery dimension. It is used to get or set the width of the matched element. It is also used to get or set the width of the matched element.

How can get image width and height in jQuery?

var imageWidth = $(Imgsize). width(); alert(imageWidth); var imageHeight = Imgsize.

How do you find the width of a div?

To measure the width of a div element we will utilize the offsetWidth property of JavaScript. This property of JavaScript returns an integer representing the layout width of an element and is measured in pixels. Return Value: Returns the corresponding element's layout pixel width.


2 Answers

Search for jQuery.each([ "Height", "Width" ], function( i, name ) { in the code (around the end of the file).

The function is defined by the following statement, when name = "Width" in the outer function.

jQuery.fn[ type ] = function( size ) {
like image 107
Dogbert Avatar answered Oct 12 '22 23:10

Dogbert


A convenient way to browse the jQuery source is using James Padolsey's interactive source viewer (unfortunately down as of this writing Update: Working again).

like image 43
Ken Redler Avatar answered Oct 13 '22 00:10

Ken Redler