ドキュメント

CSS/innerHeight

From jQuery JavaScript Library

Jump to: navigation, search

« Back to CSS

innerHeight( )

Gets the inner height (excludes the border and includes the padding) for the first matched element.
This method works for both visible and hidden elements. It is not supported for elements that are indirectly hidden by consequence of a parent being hidden. Please use .height() for the window and document.
Examples:

Get innerHeight

var p = $("p:first");
$("p:last").text( "innerHeight:" + p.innerHeight() );

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
  
  <script>
  $(document).ready(function(){
    var p = $("p:first");
$("p:last").text( "innerHeight:" + p.innerHeight() );

  });
  </script>
  <style>
  p { margin:10px;padding:5px;border:2px solid #666; }
  </style>
</head>
<body>
  <p>Hello</p><p></p>
</body>
</html>

NameType