Get computed height of element with .outerHeight()

.outerHeight()


Description: Get the computed height for an element, including padding, border, and margin.


Example:

<!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>outerHeight demo</title>
      <script src="http://code.bitsycode.com/bitsycode-latest.min.js"></script>
    </head>
    <body>
      
      <div class="mycontainer">This is my container</div>
      <div class="result"></div>
      
      <script>
         
         bitsyCode.ready(function(){
            var outerHeight = bitsyCode(".mycontainer").outerHeight();
            bitsyCode(".result").html(outerHeight);
            
            var outerHeight_setHeight = bitsyCode(".container").outerHeight("300px"); //SET HEIGHT

         })
         
      </script>
     
    </body>
    </html>

Preview:

This is my container

  • Usage

    • How to use:

      Get the computed height for an element, including padding, border, and margin.

    • USAGE:

      bitsyCode("element").outerHeight();
    • Set the height of an element:

      bitsyCode("element").outerHeight("200px"); // Pass through a height value
  • Options

    • What options are there:

      You may pass a height value as an option to set the height of the element.

  • Returns

    • Returns: the height value of the element.
      Return: 0 //returns a height value, when not setting a height
Share