I have made a quick Jsbin: http://jsbin.com/ujabew/edit#javascript,html,live
What i'm trying to achieve is to find out which is the largest <section>
out of the 3 from the link. So what i'd like is to, after the loop runs, is to have var width
set to the largest possible number that any of the widths could be.
Code in progress posted in link
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).
To set the width and height of an element using jQuery, use the width() and height() in jQuery.
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.
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.
Here:
var maxWidth = Math.max.apply( null, $( elems ).map( function () {
return $( this ).outerWidth( true );
}).get() );
Live demo: http://jsfiddle.net/rM4UG/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With