当高度大于特定像素量时隐藏div

时间:2015-05-04 19:09:15

标签: javascript jquery html css

我有一个简单的问题,当高度大于div时,我可以隐藏1000px吗?

如果div小于此高度,我们可以看到其中的内容。

1 个答案:

答案 0 :(得分:0)

Take a look at this example: http://codepen.io/anon/pen/XbmbVL

You have 2 divs, a tall one and a small one. Inside JS you have a global variable, named maxHeight.

On document ready, I hide all the data-hide-based-height div with a height that is over than maxHeight.

PS if you try to change maxHeight, for example to 150, you should see both the divs