繁体   English   中英

如何使用引导模态和角度ui获取CSS幻灯片过渡?

[英]how to get a css slide transition using bootstrap modal and angular ui?

我正在尝试使用角度ui和angular-animate在自举模式中获取幻灯片动画,我试图制作一个向导,但是似乎无法使动画正常工作。

这是我的引导程序模式的代码:

<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%;
}

希望它能帮助别人!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM