gpt4 book ai didi

javascript - 如何使用 bootstrap modal 和 angular ui 获得 css 幻灯片过渡?

转载 作者:行者123 更新时间:2023-11-28 17:54:43 26 4
gpt4 key购买 nike

我正在尝试使用 angular ui 和 angular-animate 在 Bootstrap 模式中获取幻灯片动画,我正在尝试制作向导,但我似乎无法使动画工作。

这是我的 Bootstrap 模式的代码:

<div class="modal-header">
<h3>New Template Wizard</h3>
</div>

<p>{{step}}</p>

<div ng-switch on="step">
<div class="slide" ng-switch-when="1">
<div class="list-group">
<a ng-click="stepUp()" class="list-group-item">
<h4 class="list-group-item-heading"><span class="glyphicon glyphicon-shopping-cart"></span>&nbsp;New Thing Template</h4>
<p class="list-group-item-text">A thing is a collection of devices</p>
</a>
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading"><span class="glyphicon glyphicon-off"></span>&nbsp;New Device Template</h4>
<p class="list-group-item-text">A device is a collection of sensors (channels)</p>
</a>
</div>
</div>
<div class="slide" ng-switch-when="2">
<p>STEP 2 of wizard</p>
</div>

和我的CSS:

.slide.ng-enter, .slide.ng-leave {
-webkit-transition: 575ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-moz-transition: 575ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-ms-transition: 575ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
-o-transition: 575ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
transition: 575ms cubic-bezier(0.250, 0.250, 0.750, 0.750) all;
}

.slide.ng-enter {
left: 100%;
}
.slide.ng-enter-active {
left: 0;
}
.slide.ng-leave {
left: 0;
}
.slide.ng-leave-active {
left: -100%;
}

这行不通,有什么建议吗?

最佳答案

我找到了答案,结果是 css 是错误的(我认为),无论如何这是最终的 html 和 css,它正在工作。

html:

<div ng-switch="step" class="my-switch-container">
<div class="my-switch-animation" ng-switch-when="1">
<div class="list-group">
<a ng-click="stepUp()" class="list-group-item">
<h4 class="list-group-item-heading"><span class="glyphicon glyphicon-shopping-cart"></span>&nbsp;New Thing Template</h4>
<p class="list-group-item-text">A thing is a collection of devices</p>
</a>
<a href="#" class="list-group-item">
<h4 class="list-group-item-heading"><span class="glyphicon glyphicon-off"></span>&nbsp;New Device Template</h4>
<p class="list-group-item-text">A device is a collection of sensors (channels)</p>
</a>
</div>
</div>
<div class="my-switch-animation" ng-switch-when="2">
<p>STEP 2 of wizard</p>
</div>

CSS:

.my-switch-container {
position:relative;
height:200px;
}

.my-switch-animation.ng-enter,
.my-switch-animation.ng-leave {
-webkit-transition:0.5s linear all;
transition:0.5s linear all;
height:200px;

position:absolute;
top:0;
left:0;
right:0;
}

.my-switch-animation.ng-enter {
left:50%;
}

.my-switch-animation.ng-leave,
.my-switch-animation.ng-enter.ng-enter-active {
left:0;
}

.my-switch-animation.ng-leave.ng-leave-active {

left:50%;
}

希望对其他人有帮助!

关于javascript - 如何使用 bootstrap modal 和 angular ui 获得 css 幻灯片过渡?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21537550/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com