如何在javascript中使用min-height扩展div [英] How to expand a div using min-height in javascript

查看:104
本文介绍了如何在javascript中使用min-height扩展div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我正在处理一段代码,我需要在div中填充一些点(文本)作为手风琴。我使用下面的代码实现了它。

我实现了所需的输出但是当点数增加并超过高度50px时,我丢失了一些数据。我不想要滚动条。我想增加div的高度。

我能用min-height实现输出吗?

我试过用

var tp1 = parseInt(document.getElementById(div1)。style.minheight);

但它不起作用。



请帮助



谢谢



Hi Everyone

I am working on a piece of code where I need to fill some points (text) in a div which acts as an accordion. I implemented it using the code below.
I achieved the desired output but when the points increase in numbers and goes above the height 50px, I loose some data. I dont want a scroll bar. I want to increase the height of the div.
Can I achieve the output using min-height?
I tried with
var tp1 = parseInt(document.getElementById("div1").style.minheight);
but it did not work.

Please help

Thankyou

 <script>
function doev1() {
var tp1 = parseInt(document.getElementById("div1").style.height);
if (tp1 > 0) {
document.getElementById("div1").style.height = "0px";
}
else 
{                                                   document.getElementById("div1").style.height = "50px";
}
}
</script>

推荐答案

你有没有像这样使用

document.getElementById(myDIV)。style.minHeight =100px;



我注意到在minHeight中h很小在你的语法
have u use like this
document.getElementById("myDIV").style.minHeight="100px";

I have noticed that in "minHeight" h is small in your syntax


这篇关于如何在javascript中使用min-height扩展div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆