不使用最大高度的过渡高度

时间:2022-08-24 08:01:47

I want to transition the height of a div without using max-height because the .block-content has a variable height. I got it working using max-height but when the content got larger than the max-height it didn't show it properly. I also tried using max-height: 9999999px but that also fail.

我想在不使用max-height的情况下转换div的高度,因为.block-content的高度可变。我使用max-height工作,但当内容大于最大高度时,它没有正确显示。我也试过使用max-height:9999999px,但也失败了。

I have something like this Plunker where when I click on the .block-header the .block-content shows.

我有类似Plunker的东西,当我点击.block-header时.block-content显示。

What I want is to transition the .block-content so that it looks like it slides in from the .block-header.

我想要的是转换.block内容,使其看起来像是从.block-header中滑入。

Is there anyway to achieve this?

反正有没有实现这个目标?

1 个解决方案

#1


0  

There you go JSFIDDLE. Please check it clearly and let me know...

你去JSFIDDLE。请检查清楚,让我知道......

$(document).ready(function(){
    $(".block-header").click(function(){
        $(".block-content").slideToggle("slow");
    });
});

#1


0  

There you go JSFIDDLE. Please check it clearly and let me know...

你去JSFIDDLE。请检查清楚,让我知道......

$(document).ready(function(){
    $(".block-header").click(function(){
        $(".block-content").slideToggle("slow");
    });
});