javascript 使用 jQuery 的 slideDown 和 display: inline-block

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9455588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 06:43:16  来源:igfitidea点击:

Using jQuery's slideDown with display: inline-block

javascriptjqueryslidedown

提问by themarcuz

How can I use jQuery's slideDownwith display: inline-block, as opposed to the default display: block;

我如何使用 jQuery 的slideDownwith display: inline-block,而不是默认的display: block;

Some of the content inside the div I'm using requires it to be so, and the design partly breaks unless I fix it. However, fixing it after the sliding down has finished will be glitchy.

我正在使用的 div 中的一些内容要求它如此,除非我修复它,否则设计会部分中断。但是,在滑下完成后修复它会出现故障。

Any ideas?

有任何想法吗?

回答by themarcuz

You should probably wrap the div with display: inline-block, into another div, with simple display: none, that will be the target of your slideDown function. I made up a demo for you here http://jsfiddle.net/d3BHL/2/
Let me know if it helps

您可能应该使用display: inline-block,将 div 包装到另一个 div 中,使用 simple display: none,这将是您的 slideDown 函数的目标。我在这里为您制作了一个演示http://jsfiddle.net/d3BHL/2/
如果有帮助,请告诉我