1
我的HTML看起來像這樣;ngAnimate什麼也不做?
<div class="loadingmsg" ng-show="!isReady()" ng-animate="{show:'animate-show', hide:'animate-hide'}">
<div class="loadingmsg-txt glyphicon glyphicon-flash">{{msg.loading || 'loading'}}</div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{msg.loadingPerc}}" aria-valuemin="0" aria-valuemax="100" style="width: {{msg.loadingPerc}}%;">
{{msg.loadingPerc}}%
</div>
</div>
</div>
而且我已將必要的類添加到CSS;
.animate-show, .animate-hide {
-webkit-transition:all linear 1s;
-moz-transition:all linear 1s;
-ms-transition:all linear 1s;
-o-transition:all linear 1s;
transition:all linear 1s;
}
.animate-show {
opacity:0;
}
.animate-show.animate-show-active {
opacity:1;
}
.animate-hide {
opacity:1;
}
.animate-hide.animate-hide-active {
opacity:0;
}
這一切都很簡單。
但隨後,無論何時!isReady()
返回true
,我想div
淡出。這並沒有發生,絕對沒有過渡。
我在做什麼錯?
編輯 新的CSS:
.loadingmsg.ng-hide-add,
.loadingmsg.ng-hide-remove {
-webkit-transition:all linear 10s;
-moz-transition:all linear 10s;
-ms-transition:all linear 10s;
-o-transition:all linear 10s;
transition:all linear 10s;
}
.loadingmsg.ng-hide-add {
opacity: 0;
}
.loadingmsg.ng-hide-remove {
opacity: 1;
}
和HTML:
<div class="loadingmsg" ng-show="!isReady()">
<div class="loadingmsg-txt glyphicon glyphicon-flash"></div>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{msg.loadingPerc}}" aria-valuemin="0" aria-valuemax="100" style="width: {{msg.loadingPerc}}%;">
{{msg.loadingPerc}}%
</div>
</div>
</div>
但是,這仍然沒有任何區別。
的哪個版本AngularJS你在用嗎?這是最新的嗎? (動畫使用版本不同) – callmekatootie
@callmekatootie'1.2.6' – Ashesh
您是否包含'angular-animate.js'? - >'' – Vucko