我正在尝试打开物化模式,从上到下下垂,完全像在这把小提琴中,但从上到下反向。不幸的是,很难在物化模式上修改某些东西,因为有些css属性是从物化js中添加的。自下而上的特殊效果是由“底部工作表”类添加的,但是不存在“顶层”类。
.modal.bottom-sheet {
top: auto;
bottom: -100%;
margin: 0;
width: 100%;
max-height: 45%;
border-radius: 0;
will-change: bottom, opacity;
}那么,我如何才能改变打开的效果,以扭转和模态打开,从上到下?
发布于 2017-03-21 13:23:33
我知道这个解决方案太麻烦了,但至少有效。
.modal.top-sheet {
top: 0% !important;
bottom: auto !important;
transition: transform cubic-bezier(0.22, 0.61, 0.36, 1) .2s;
will-change: transform;
transform: translate(0, -100%) scale(1) !important;
width: 100%;
opacity: 1 !important;
}
.modal.top-sheet.open {
transition: transform cubic-bezier(0.22, 0.61, 0.36, 1) .35s .25s;
}
.modal.top-sheet.open:not([style*="display: none"]):not([style*="opacity: 0;"]) {
transform: translate(0, 0%) !important;
}https://jsfiddle.net/xmz0afhf/1/
原则:
编辑:更新后,您可以分别使用底部工作表和顶部工作表。
发布于 2017-03-21 13:19:46
物化模态在默认情况下通过缩放模式对话框提供自上而下的效果。如果您想要从上到下滑动功能,那么您可以使用简单的$.slideToggle()。但是,如果您想修改物化JS,那么您可以使用下面的代码尝试小提琴,
$(document).ready(function() {
$('#modal1').modal({
startingTop: '0', // Starting top style attribute
endingTop: '10%', // Ending top style attribute
});
});发布于 2017-03-21 13:33:45
就像罗汉·库马尔所说的,物化确实给了你改变模态行为的可能性。您可以在这里查看:物化模态选择
这就是我在Fiddler网站上看到的:https://jsfiddle.net/7f6hmgcf/25/
$(document).ready(function() {
$('.modal').modal({
dismissible: true, // Modal can be dismissed by clicking outside of the modal
opacity: .5, // Opacity of modal background
inDuration: 300, // Transition in duration
outDuration: 200, // Transition out duration
startingTop: '-10%', // Starting top style attribute
endingTop: '10px', // <-- HEIGHT OF THE BUTTON
ready: function(modal, trigger) { // Callback for Modal open. Modal and trigger parameters available.
console.log(modal, trigger);
},
complete: function() { alert('Closed'); } // Callback for Modal close
}
);
});https://stackoverflow.com/questions/42927688
复制相似问题