第一步:引入angular-animate.js



第二步:注入ngAnimate

	var lxApp = angular.module("lxApp", [ 'ngAnimate' ]);

第三步:定义controller,设置好三张轮播图片

.z_login_bg1 {
position: absolute;
width: 100%;
height: 100%;
left: 0;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-image: url("themes/default/images/bg1.jpg");
} .z_login_bg2 {
position: absolute;
width: 100%;
height: 100%;
left: 0;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-image: url("themes/default/images/bg2.jpg");
} .z_login_bg3 {
position: absolute;
width: 100%;
height: 100%;
left: 0;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-image: url("themes/default/images/bg3.jpg");
}

<body ng-controller="lxCtrl">
<div ng-if="bgindex==0" class="z_login_bg1 bg_exchange"></div>
<div ng-if="bgindex==1" class="z_login_bg2 bg_exchange"></div>
<div ng-if="bgindex==2" class="z_login_bg3 bg_exchange"></div>
</body>

第四步:制作动画效果

lxApp.animation(".bg_exchange", [ "$animateCss", function($animateCss) {
return {
enter : function(element) {
return $animateCss(element, {
from : {
opacity : 0
},
to : {
opacity : 1
},
duration : 0.5
});
},
leave : function(element) {
return $animateCss(element, {
from : {
opacity : 1
},
to : {
opacity : 0
},
duration : 0.5
});
}
};
} ]);

第五步:使用$interval控制图片切换

lxApp.controller("lxCtrl", function($interval,$scope) {
$scope.bgindex = 0;
$interval(function() {
$scope.bgindex++;
if ($scope.bgindex >= 3) {
$scope.bgindex = 0;
}
}, 5500);
});

第六步:手动启动angular

	angular.bootstrap(document,['lxApp']);

AngularJS实战之ngAnimate插件实现轮播的更多相关文章

  1. Bootstrap的js插件之轮播(carousel)

    轮播请查看下面演示样例.基本已经涵盖最经常使用的一个轮播 <!DOCTYPE html> <html lang="en"> <head> < ...

  2. React中使用CSSTransitionGroup插件实现轮播图

    动画效果,是一个页面上必不可少的功能,学习一个新的东西,当然就要学习,如何用新的东西,用它的方法去实现以前的东西啦.今天呢,我就在这里介绍一个试用react-addons-css-transition ...

  3. vue项目全局引入vue-awesome-swiper插件做出轮播效果

    在安装了vue的前提下,打开命令行窗口,输入vue init webpack swiper-test,创建一个vue项目且名为swiper-test(创建速度可能会有点慢,耐心等),博文讲完后,源码托 ...

  4. ionic3 使用swiper插件 实现轮播效果

    由于app的更新迭代 我需要完成新版本设计图的开发 刚开始就遇到一个问题  首页的banner图需要实现某种效果 而ionic3自带的轮播图效果怎么改都改不到我想要的效果 效果图如下  自动播放 不断 ...

  5. 插件-3D轮播图

    先上效果图 查看实例点击 这里  这个栗子中,可以选择展示 5 张 或者展示 3 张,即使是只有一个slide,也可以完成布局,正常轮播,麻麻再也不用怕只有4个slid而不能用这种轮播啦! 本栗实现原 ...

  6. Bootstrap插件-carousel(轮播图)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. Jquery插件---渐隐轮播

    //需求:打开网页时,每秒钟自动切换下一张图片内容.也可以用鼠标点导航按钮进行图片切换 //代码如下 <!DOCTYPE html> <html lang="en" ...

  8. layui常用插件(一) 轮播图

    轮播图 <html lang="en"> <head> <meta charset="UTF-8"> <meta ht ...

  9. slider插件制作轮播图

    html代码: <div id="banner_tabs" class="flexslider"> <ul class="slide ...

随机推荐

  1. centos更换yum源为aliyun源

    国外的yum源由于众所周知的GFW原因,有的被墙,有的很慢,阿里云依靠强大的技术优势建立了国内的开源镜像.阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ 第一步: ...

  2. ERROR: APK path is not specified for

    1. 打开project structure 2.设置outpath路径 最好为绝对路径 点击确定  重新编译即可. Note: Android Studio版本使用

  3. Http方式下载文件

    代码: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System ...

  4. c#devexpres窗体划分 以及panelcontrol 相关操作

    想模仿flashfxp  做一个svn上传的客户端 左侧为本地目录,右侧为svn服务器目录 准备用devexpress 的 控件实现,顺便练习一下devexpress 相关使用. 1:要实现菜单栏工具 ...

  5. c# sharpsvn 客户端开发总结

    判断文件夹是否是 working copy 工作副本两个方法 if (!IsWorkingCopy(localPath))//查看某目录是否是受svn管理的状态, 即是否为工作副本 { notiny ...

  6. UVA 11235 (RMQ) 频繁出现的数值

    题目大意是给出一个非降序排列的数组,然后n个询问,每次询问一个区间内出现次数最多的数的次数. 首先要弄清楚题目的是一个非降序的数组,那么说明相等的数都会在一起,类似于11223334569这样的,那么 ...

  7. spring自动注解Autowired配置

    1.spring注解:http://blog.csdn.net/xyh820/article/details/7303330/ 2.最简ssm配置:http://blog.csdn.net/qq_18 ...

  8. Luogu1501 Tree II - LCT

    Code #include<cstdio> #include<cstring> #include<algorithm> #define rd read() #def ...

  9. Firebird存储过程--更加人性化的设计

    Firebird存储过程--更加人性化的设计 begin For select house_id,goods_id ,qty from  table1 where id=:VAR_ID into :v ...

  10. PS合成的5个要点:场景、对比、氛围、模糊、纹理

    是否觉得做合成打开PS之后无处下手,做完之后总觉得缺少故事情节?这一次分享的5个要点,是个人觉得需要重视的,每一点都有一个案例来让作品变得多一份惊喜.(申明:文中素材均来自网络,这里仅作分享交流作用) ...