简体   繁体   English

jQuery切换,更改高度

[英]jQuery toggle, changing height

Hello im trying to get a box from the right to get a width of 100px 您好我正在尝试从右侧获取一个框以获取100px的宽度

But i have the problem when im showing and hiding the box the height changes. 但是我在显示和隐藏框的高度变化时遇到了问题。 I have a picture to show: 我要显示图片: 在此处输入图片说明

Like you see the height is getting smaller when it shouldn't anyone know how to stop this? 就像您看到的那样,当有人不应该停止这种高度时,高度会变小吗?

We don't have your code, but it can be solved by adding 我们没有您的代码,但是可以通过添加来解决

yourElement.style.height = normalHeightSize;

In JQuery, 在JQuery中

$('#yourElement').css('height: normalHeight');

when the user shows the box, in their click event or whatever happens in the code. 当用户在其点击事件或代码中发生的任何情况下显示该框时。 In your case, after toggle() . 就您而言,在toggle()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM