Skip to content Skip to sidebar Skip to footer

Resize Of Div Is Being Ignored

I have a super-simple web page that loads data from a server into s as containers. The problem is that sometimes images are too tall, and overflow and cause layout problems. So, I

Solution 1:

you didnt show what you assigned to 'height', but from your code i assume its an interger.

document.getElementById(d0).style.height = height+10;

style takes a string (ie 10px), so assigning number to it won't work, try the following

document.getElementById(d0).style.height = height+10+'px';

javascript will convert it to string for you more on integer to string here What's the best way to convert a number to a string in JavaScript?

Solution 2:

Add a unit to your height variable. As you are editing the CSS style of the element this is required. See: MDN

document.getElementById('someId').style.height=height becomes: document.getElementById('someId').style.height = height.toString() + 'px'

Post a Comment for "Resize Of Div Is Being Ignored"