Quantcast
Channel: PHP Scripts | Java scripts for web development
Viewing all articles
Browse latest Browse all 12

Div height after page load using jQuery

$
0
0

Every time we start exploring new things, we get new tips and tricks to do the work. I am looking for the solution to get height of Div but after load the page, after so many hit and trial I got the solution, may be and of course some other solutions also there to do this.

first I am looking for div height using the below code

$("#div-name").height();

But after load the image it will change the size of Div, so I need to find the solution for after load the page and get the height of div, I try the below

jQuery(document).ready(function(){
$("#div-name").height();
});

Or

$(window).load(function(){
$("#div-name").height();
});

You can get the outer height of the div too.

$(window).load(function(){
$("#div-name").outerHeight();
});

and finally you can put it in css style.

$(function(){
var newdiv = $('#divname');
$('#divheightset').css({ height: newdiv.outerHeight()});
});

To place the div height dynamically or run time to manage the div height.


Viewing all articles
Browse latest Browse all 12

Latest Images

Trending Articles





Latest Images