如何更改棘轮模式,使其从顶部向下滑动,仅占据屏幕的50%,而不是整个高度?
模态的css是;
.modal {
position: fixed;
top: 0;
z-index: 11;
width: 100%;
min-height: 100%;
overflow: hidden;
background-color: #fff;
opacity: 0;
-webkit-transition: -webkit-transform .25s, opacity 1ms .25s;
-moz-transition: -moz-transform .25s, opacity 1ms .25s;
transition: transform .25s, opacity 1ms .25s;
-webkit-transform: translate3d(0, 100%, 0);
-ms-transform: translate3d(0, 100%, 0);
transform: translate3d(0, 100%, 0);
}
.modal.active {
height: 100%;
opacity: 1;
-webkit-transition: -webkit-transform .25s;
-moz-transition: -moz-transform .25s;
transition: transform .25s;
-webkit-transform: translate3d(25%, 0, 0);
-ms-transform: translate3d(25%, 0, 0);
transform: translate3d(25%, 0, 0);
}
我一直在尝试不同的值,但无法达到我想要的值。
最佳答案
我很确定这已经很接近了,但是目前还不能真正对其进行测试。transform: translate3d(0,-100%,0);
应该在屏幕顶部启动模态,而transform: translate3d(0,50%,0);
在激活时应将其移动到中间。然后明显的高度变为50%...
.modal.active {
height: 50%;
opacity: 1;
-webkit-transition: -webkit-transform .25s;
-moz-transition: -moz-transform .25s;
transition: transform .25s;
-webkit-transform: translate3d(0,50%,0);
-ms-transform: translate3d(0,50%,0);
transform: translate3d(0,50%,0);
}
.modal {
position: fixed;
top: 0;
z-index: 11;
width: 100%;
min-height: 50%;
overflow: hidden;
background-color: #fff;
opacity: 0;
-webkit-transition: -webkit-transform .25s,opacity 1ms .25s;
-moz-transition: -moz-transform .25s,opacity 1ms .25s;
transition: transform .25s,opacity 1ms .25s;
-webkit-transform: translate3d(0,-100%,0);
-ms-transform: translate3d(0,-100%,0);
transform: translate3d(0,-100%,0);
}
关于html - 更改棘轮模式尺寸并滑动到适当位置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32519288/