Hello reader's,
Below is the example for Getting height width or element using Jquery
If you having trouble with such issues, then use the below code to resolve such issues.
Here is the HTML
<button id="dummy-height">Get div Height or width</button>
<button id="dummy-width">Get Document width</button>
<div> </div>
<p>
<img class="dummy-profile" src="http://jp-australia.com/2013/sup/wp-content/themes/jp-australia/img/rider_profile-image_dummy.png">
</p>
Here is the css
button {
font-size: 14px;
margin: 2px;
padding:7px;
}
div {
color: red;
font-weight: bold;
}
Here is the js
function showHeightwidth( element, height ) {
$( "div" ).text( "The height for the " + element + " is " + height + "px." );
}
$( "#dummy-height" ).click(function() {
showHeightwidth( "dummy-profile", $( ".dummy-profile" ).height() );
});
$( "#dummy-width" ).click(function() {
showHeightwidth( "dummy-profile", $( ".dummy-profile" ).width() );
});
0 Comment(s)