<!DOCTYPE html>
<html ng-app="MyApplication"> <head>
<link rel="stylesheet" href="style.css">
<script src="https://code.angularjs.org/1.5.0-beta.2/angular.js"></script>
<script src="https://code.angularjs.org/1.5.0-beta.2/angular-animate.js"></script>
<script src="script.js"></script>
</head> <body ng-controller="ApplicationController as app"> <div class="banner-container">
<img ng-src="{{ app.currentBannerImage }}"
class="animate-banner"
ng-animate-swap="app.currentBannerImage" />
</div>
</body> </html>
angular.module('MyApplication', ['ngAnimate'])

  .controller('ApplicationController', ['$interval', function($interval) {
var banners = [
'http://ng-slides.appspot.com/ng-animate-swap-demo/Banner1.jpg',
'http://ng-slides.appspot.com/ng-animate-swap-demo/Banner2.jpg',
'http://ng-slides.appspot.com/ng-animate-swap-demo/Banner3.jpg'
]; var index = 0, self = this; this.setBanner = function(i) {
self.currentBannerImage = banners[index];
}; this.setBanner(0); $interval(function() {
index++;
index = index % banners.length;
self.setBanner(index);
}, 3000);
}])
html {
padding:;
margin:;
} body {
padding:20% 0;
} .banner-container {
height:200px;
width:500px;
overflow:hidden;
margin:0 auto;
border:5px solid black;
position:relative;
} .animate-banner.ng-enter, .animate-banner.ng-leave {
position:absolute;
top:;
left:;
right:;
height:100%;
transition:1s ease-out all;
} .animate-banner.ng-enter {
opacity: 0.3;
left:-100%;
}
.animate-banner.ng-enter-active {
opacity:;
left:;
}
.animate-banner.ng-leave {
opacity:;
left:0%;
}
.animate-banner.ng-leave-active {
opacity:0.3;
left:100%;
}

[AngularJS] New in Angular 1.5 ng-animate-swap的更多相关文章

  1. [Angular] Use Angular components in AngularJS applications with Angular Elements

    When migrating AngularJS (v1.x) applications to Angular you have different options. Using Angular El ...

  2. 【js类库AngularJs】解决angular+springmvc的post提交问题

    [js类库AngularJs]解决angular+springmvc的post提交问题 AngularJS诞生于2009年,由Misko Hevery 等人创建,后为Google所收购.是一款优秀的前 ...

  3. [AngularJS] New in Angular 1.3 - Performance Boost with debugInfoEnabled

    By default, Angular provides a lot of debug information on the DOM that's only necessary for tools l ...

  4. ng animate

    要在angular中加入动画必须引入angular.animate.js插件,然后就可以在module中引入ngAnimate模块.如: var module1 = angular.module('m ...

  5. [AngularJS] Lazy loading Angular modules with ocLazyLoad

    With the ocLazyLoad you can load AngularJS modules on demand. This is very handy for runtime loading ...

  6. AngularJS进阶(五)Angular实现下拉菜单多选

    Angular实现下拉菜单多选 写这篇文章时,引用文章地址如下: http://ngmodules.org/modules/angularjs-dropdown-multiselect http:// ...

  7. AngularJS进阶(四)ANGULAR.JS实现下拉菜单单选

    ANGULAR.JS: NG-SELECT AND NG-OPTIONS PS:其实看英文文档比看中文文档更容易理解,前提是你的英语基础还可以.英文文档对于知识点讲述简明扼要,通俗易懂,而有些中文文档 ...

  8. angular 2 - 001 ng cli的安装和使用

    angular cli 创建项目和组件 ng new my-app --skip-install cd my-app cnpm install ng serve localhost:4200 angu ...

  9. [AngularJS] Using the Angular scope $destroy event and method

    With Angular scopes, you have access to a $destroy event that can be used to watch $scope events. Th ...

随机推荐

  1. SQL Server 2008创建定期自动备份任务

    首先需要启动SQL Server Agent服务,这个服务如果不启动是无法运行新建作业的,点击“开始”–“所有程序”–“Microsoft SQL Server 2008”–“启动SQL Server ...

  2. 使用Cxf发布Webservice服务,如果待发布的接口中有重载方法,怎么处理??

    使用 @WebMethod(operationName="multiParamByName")  重新指定名字. http://bbs.csdn.net/topics/270059 ...

  3. 在SpringMVC框架下建立Web项目时web.xml到底该写些什么呢?

    刚刚初学Spring MVC,却连一个简单的helloworld都搞的懵懵懂懂的,配置文件搞不清,各种文件之间的逻辑关系也不懂,连续看了好些日子的Spring MVC了,今天终于下定决心,每天记录一点 ...

  4. PHP PDO 简单登陆操作

    用PHP做出一个简单的登陆操作,确实很简单,下面就让我给大家简单的介绍一下PDO做出一个登陆界面操作的过程,因为也是初学乍练,不足之处请大家包涵. 首先,首先还要建一个表,在MySQL中建表,核心代码 ...

  5. 12_RHEL7.1普通用户添加sudo权限

    1.关于sudo Sudo是linux系统中,非root权限的用户提升自己权限来执行某些特性命令的方式,它使普通用户在不知道超级用户的密码的情况下,也可以暂时的获得root权限.          一 ...

  6. 发一个自己写的php框架

    这个框架是我在学习php初期练手写的,现在分享出来希望对初学者有一定帮助. 目录结构:app:网站系统目录    ---common:网站配置目录    ---tpl:网站模板目录    ---log ...

  7. C语言基础学习运算符-关系运算符

    比较大小 首先,我们得先了解一下布尔类型.C语言的C99标准支持布尔类型,关键字为_Bool,用于表示逻辑值true与false.C语言用值1表示true, 用值0表示false.因此布尔类型实际上是 ...

  8. ASP.NET中Request.ApplicationPath、Request.FilePath、Request.Path、.Request.MapPath

    1.Request.ApplicationPath->当前应用的目录 2.Request.FilePath->对应于iis的虚拟目录   如 URL http://mockte.com/1 ...

  9. -_-#【乱码】URL中文参数

    JavaScript利用URL向后台传入中文参数乱码问题解决之道! encodeURIComponent(encodeURIComponent('ya呀')) http://wap.baomihua. ...

  10. (2015年郑州轻工业学院ACM校赛题) A 彩票

    这是个简单的题目,其实就是判断是否是偶数, 对二进行特判一下就行了! 比赛时候我们还错两次................ 一看简单题就想抢一血,谁知到第一次提交CE, 再提交WA 汗........ ...