- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图让离开动画与速度和 Angular 一起工作,以便当表格行离开时它们会向右移动。
在示例中,我使用离开回调来尝试动画离开 ng-repeat,但回调运行但没有任何反应!
angular.module('myApp', ['ngAnimate'])
.controller('myCtrl', function($scope) {
$scope.items = ['item1', 'item2', 'item3']
$scope.shiftItems = function() {
var items = ['asdf', 'bill', 'bob', 'joe', 'items']
for (var i = 0; i < $scope.items.length; i++)
$scope.items.shift()
for (var i = 0; i < items.length; i++)
$scope.items.push(items[i])
}
})
.animation('.velocity-tableSlideInOut', [function() {
return {
enter: function(element, done) {
Velocity(element, 'transition.slideLeftIn', [0.36, 0.96, 0.6, 0.96])
},
leave: function(element) {
Velocity(element, {opacity: 0}, [0.4, 0.04, 0.64, 0.04])
}
}
}])
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.2/velocity.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.2/velocity.ui.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular-animate.js"></script>
<div ng-app='myApp'>
<ul ng-controller='myCtrl'>
<li class='velocity-tableSlideInOut' ng-repeat='item in items track by $index'>
{{item}}
</li>
<li>
<button ng-click='shiftItems()'>Reorder</button>
</li>
</ul>
</div>
最佳答案
这实际上是使用 track by $index
时的预期行为。
您从 3 个项目开始,索引将为:
0 1 2
您删除了这 3 个项目,添加了 6 个新项目,现在有了索引:
0 1 2 3 4 5
没有剩余索引,因此不会触发离开动画。但是有 3 个新索引,因此索引为 3、4 和 5 的项目将触发进入动画。
解决方案是跳过跟踪
或按与对象实际相关的属性(例如唯一 ID)进行跟踪。如果您的集合仅包含字符串并且您需要支持重复项,则需要将它们包装在对象中,例如:
{ value: 'item1' }
关于javascript - ngAnimate 的离开回调的速度动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28761082/
var newRight; if(either.isRight()) { newRight = either.getOrElse(() => throw UnimplementedError())
我正在做一个登录字段。它由 UITextfields 和一个弹出选择器 Controller 的按钮组成。单击按钮以显示按钮弹出时,我想删除/保留/取消编辑文本字段。 我试过: [发件人resignF
我试图在用户关闭选项卡或转到另一个选项卡(如 facebook、gmail、GoDaddy 和其他选项卡)之前显示确认弹窗。 我的代码适用于 Firefox,但不适用于 chrome、safari 等
我无法退出代码中的 While 循环和方法。用户可以选择输入 1 或 2 和 0 来取消(离开菜单和方法)。但是就像现在的代码一样,我猜 Switch 中的默认选项会阻止它离开 While 循环!?我
所以我目前正在学习这个关于 PHP 表单的教程,并且我把它放到了这个页面的底部,它说到目前为止要测试表单,http://www.webreference.com/programming/php/sea
我正在开发一个可以让用户登录 2 个 xmpprooms 的应用程序,但同时只能登录 2 个,所以如果他想连接到另一个,我必须断开他与前一个的连接并连接到下一个。使用此代码: 这是我离开房间的方式:
我目前正在 React 应用程序中使用我的网络摄像头拍照。然而,当我离开组件时,绿灯继续亮着,我似乎无法关闭我的网络摄像头。这是我用来使用网络摄像头的代码。 navigator.webkitGet
实际到达很简单,标签进入接收器天线范围,但是偏离是造成问题的原因。 首先,我们了解一些有关设置的信息。 标签: 它们以433Mhz的速度工作,每1.5秒钟发送一次“心跳”,移动时进入传输突发模式,这种
这是我的第二个问题(已经回答):Creating SharedPreferences object inside Fragment . 在弄清楚如何在静态 Fragment 类中创建 SharedPr
我需要离开 Firebase 中的一个项目,但我没有选择离开该项目,因为我没有该项目的所有权。我是该项目的成员,需要离开该项目,因为该项目的开发已在几个月前停止 有什么选择可以做到这一点吗?我还需要从
我希望在以下情况下触发我的 javascript: 当打开多个 IE 选项卡时,当前 IE 选项卡将被切换。 当前 IE 选项卡关闭时。 我不希望我的 JS 代码被页内弹出对话框触发。 当整个 IE
我在 socket.io wiki 上查看如何使用房间,但加入和离开不起作用,我想知道他们是否可能更改了一些内容但没有机会更新 wiki? socket.join("room-"+data.meid)
在此 Activity 中我使用振动,因此由用户选择按照振动节奏移动的球,但是当我想向后返回屏幕时,即返回到MainActivity,应用程序继续振动而不停止。这是我的代码,我已经尝试了所有方法,但无
我正在构建一个用于学习 SwiftUI 的小型待办事项应用程序,我可以在 CoreData 中创建一个任务列表并将它们标记为完成,这会将 isComplete 设置为 true 并将图像从空圆圈更改为
我在 if 语句中有一个 if 语句。 如果第二个if语句中的条件返回false,我要转到第一个else因为它会自动设置我的验证控件。 希望你明白 if (page.isvalid() ) {
我正在尝试找到一种方法,让我的变量在应用程序的整个生命周期中保持不变。我设计该应用程序的方式是用户单击类(class)并提交成绩。我想要的是应用程序在 Activity 结束后存储成绩。当用户退出屏幕
首先你应该知道,允许玩家玩的区域是一个正方形,即320x320,位于屏幕中央。这个 320x320 的正方形是一个 5x5 的网格 [每个图 block 64x64],并且玩家始终位于网格图 bloc
我的应用程序在离开 UIViewController 时崩溃并出现以下错误。 [FeedSingleViewCell retain]: message sent to deallocated inst
使用此代码允许媒体播放器在全屏时横向旋转(应用程序不支持): // handle orientation for the device func application (_ application:
好的。查看了可能的答案,但我在这里没有看到我的问题。 我有一个相当标准的 GCD 重复计时器: class RepeatingGCDTimer { /// This holds our cur
我是一名优秀的程序员,十分优秀!