我正在使用Jquery向导插件。我遇到的问题是,向导的每一步都有不同高度的内容。示例中包含的用于控制内容高度的css是
.wizard > .content
{
background: #eee;
display: block;
margin: 0.5em;
min-height: 35em;
overflow: hidden;
position: relative;
width: auto;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}我已经调整了最小高度和溢出属性,但它仍然不能完成我想要完成的任务。我想要的是高度只有足够高,以适应每一步的内容。
例如,假设步骤1有两个字段,步骤2有10个字段。在示例中,内容都是相同的高度,因此,如果要容纳步骤2中的10个字段,那么具有比这两个字段更大的高度看起来很糟糕。
如果删除min高度属性,则不会显示任何内容。Jquery步骤是否需要固定的高度才能适用于所有步骤?我希望有一种方法,使高度动态,以适应每一步的高度。
谢谢
发布于 2014-05-27 20:18:48
删除jquery.steps.css中下面类的高度属性
.wizard > .content > .body{height:95%;}在- jquery.steps.js搜索中:
stepTitles.eq(state.currentIndex)
.addClass("current").next(".body").addClass("current");应该在844号线附近。在直接后面加上:
stepTitles.eq(state.currentIndex).next(".body")
.each(function () {
var bodyHeight = $(this).height();
var padding = $(this).innerHeight() - bodyHeight;
bodyHeight += padding;
$(this).after('<div class="' + options.clearFixCssClass + '"></div>');
$(this).parent().animate({ height: bodyHeight }, "slow");
});这个问题肯定会得到解决。
发布于 2018-04-15 02:32:52
只有一行css适合我。它会自动调整每一段的高度。
.wizard > .content > .body{位置:相对!重要;}
发布于 2018-03-27 15:16:17
如果有人在这么多年后发现了这一点,那么问题仍然存在。以下是如何在不更新javascript的情况下修复它,只使用css:
.wizard .content {
min-height: 100px;
}
.wizard .content > .body {
width: 100%;
height: auto;
padding: 15px;
position: absolute;
}
.wizard .content .body.current {
position: relative;
}src:https://github.com/rstaib/jquery-steps/issues/8#issuecomment-368114763
https://stackoverflow.com/questions/22819061
复制相似问题