height


Apply Document Height to a div using Jquery


Merry Xmas,
I have an issue in applying div height using jquery.
I need to have the (.leftstatbar) div to be of the height of the entire document. But thats not happening with this. There is a white space at the bottom, as the other document exceeds the height of this div.
Here is what I have tried
<script type="text/javascript">
$(document).ready (function (){
var winWidth = $ (window).innerWidth();
var winHeight = $ (document).innerHeight();
// set initial div height / width
$('.leftstatbar').css({
'width': '250px',
'height': winHeight
});
$(window).resize(function(){
var winWidth1 = $ (window).innerWidth();
var winHeight1 = $ (document).innerHeight();
$('.leftstatbar').css({
'width': '250px',
'height':winHeight1
});
});
});
My issue is , With the above code I am unable to get the initial height. My document is lengthier than the div (.leftstatbar). Another problem is with the resizer. It resizes initially but then it wont.
Kindly support
Many Thanks
The methods innerHeight() and innerWidth() do not apply to the window or document objects. You should use height() and width() instead. See here: http://api.jquery.com/innerHeight/
The issue with your resizer is that you are doing a closure on the initial values from the calls to innerHeight() and innerWidth() and then setting the size of DIV to the same value over and over as the resizer is called. You should set the value of the height to the height of the document at the time the function is called (dynamically).
$(window).resize(function(){
$('.leftstatbar').css({
'width': '250px',
'height':$(document).css("height");
});
});
Use .css("height") instead of height() in this case to automatically include the units (px).

Related Links

ui-grid ng-style dynamic height
I want amplitude of Q waves in QRS complex. For R and S, I found them
Falling Object Initial Value
Subliem text3 AutoFileName: How to change it, that it will add width and heigth attributes in Sublieme text 3
Finding the Table height and Width in Word Document
FontForge how to get height of contour in script
how to set another elemtnt's height based on slider height in this context
Classic asp control character height in dropdown
Auto adjust row height to max height value
How to calculate Height of any control which is loaded in DataTemplate?
Xamarin Forms - Get the size of an AbsoluteLayout
Amcharts : small (sometimes 0px) chart height on page load (in default tab)
Spacing between 2 lines HTML/ PHP and CSS
How to change embedly height
Cell/Row heightand vertical align in PhpWord
How to make 2 divs to fill 100% viewport height

Categories

HOME
python
visual-studio-2015
sidekiq
project-management
itext
amazon-swf
rotation
antivirus
formal-verification
transparent
wampserver
appmaker
iis-7.5
urlencode
triggers
aruco
dropbear
diagram
facebook-javascript-sdk
iso
lagom
mod-pagespeed
scala-native
alfresco-share
zend-framework-mvc
attask
marathon
url.action
avplayeritem
visual-c++-2017
web-frontend
ab-initio
thinking-sphinx
blackboard
helix-3d-toolkit
threshold
pace
socketpair
magiczoomplus
infusionsoft
crop
powermta
finite-element-analysis
encapsulation
estimation
jtds
proof
appstore-approval
workflow-foundation-4.5
maintenance
google-maps-ios
rpostgresql
tofixed
visual-studio-templates
rxvt
emgu
garrys-mod
nsfetchedresultscontrolle
ebtables
xib
ruby-2.0
angularjs-ng-pattern
dac
lmfit
mptcp
risk-analysis
vine
rx-groovy
ibm-data-studio
chaining
left-recursion
line-numbers
jstat
docopt
java-collections-api
facebook-wall
alpha-transparency
pic24
delphi-xe3
resource-files
android-json-rpc
roxygen
angulartics
document-database
vmware-server
google-closure-library
pep8
database-permissions
mozart-mvc
cbcentralmanager
linkedhashset
datarepeater
isolatedstorage
ajax.beginform
surf
serp
goliath
opengl-es-lighting
gethashcode
audiostreamer
getresource
system-codedom-compiler
data-execution-prevention

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App