![]() We simply use the drawImage () method to draw our image on the canvas after that. These values are also used to set the width and height of the canvas. We then calculate newHeight by dividing the width by our calculated aspect ratio. Similarly, you can estimate the change in height while setting the outer height. The value of the newWidth variable determines how wide we want the image to be when its resized. New Width = Outer Width - (Horizontal Padding + Horizontal Border). These methods only alter the width or height of the element's content area to match the specified value, like the innerWidth() and innerHeight() methods.įor example, if the current width of the element is 300 pixels, and the sum of the left and right padding is equal to 50 pixels, and the sum of the width of the left and right border is 20 pixels than the new width of the element after setting the outer width to 400 pixels is 330 pixels i.e. Similarly, you can set the element's outer width and height by passing the value as a parameter to the outerWidth() and outerHeight() methods. $("#result").html("Outer Width: " + divWidth + ", " + "Outer Height: " + divHeight) Var divHeight = $("#box").outerHeight(true) Var divWidth = $("#box").outerWidth(true)
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |