用AngularJs做一个大图轮播
<!DOCTYPE html>
<html ng-app="myApp" lang="en">
<head>
    <meta charset="UTF-8">
    <title>AngularJS carousel</title>
    <link href="http://libs.baidu.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .carousel-indicators li {
            margin-left: 5px;
            margin-right: 5px;
        }
    </style>
</head>
<body>
    <div ng-controller="CarouselDemoCtrl" style="margin-top: 15px;">
        <div style="height: 305px">
            <carousel interval="myInterval" no-wrap="noWrapSlides">
                <slide ng-repeat="slide in slides" active="slide.active">
                    <img ng-src="{{slide.image}}" style="margin:auto;width:1000px;height: 600px;" />
                    <div class="carousel-caption">
                        <p>{{slide.text}}</p>
                    </div>
                </slide>
            </carousel>
        </div>
    </div>

    <script src="http://apps.bdimg.com/libs/angular.js/1.3.13/angular.min.js"></script>
    <script src="http://apps.bdimg.com/libs/angular.js/1.4.0-beta.4/angular-animate.min.js"></script>
    <script src="http://cdn.bootcss.com/angular-ui-bootstrap/0.13.3/ui-bootstrap.min.js"></script>
    <script src="http://cdn.bootcss.com/angular-ui-bootstrap/0.13.3/ui-bootstrap-tpls.min.js"></script>
    <script>
        angular.module('myApp', ['ui.bootstrap', 'ngAnimate']).controller('CarouselDemoCtrl', function ($scope) {
            $scope.myInterval = 5000;
            $scope.noWrapSlides = false;
            var slides = $scope.slides = [];
            $scope.addSlide = function () {
                var newWidth = 600 + slides.length + 1;
                slides.push({
                    image: '../img/1.jpg',
                });
                slides.push({
                    image: '../img/2.jpg',
                });
                slides.push({
                    image: '../img/3.jpg',
                });
                slides.push({
                    image: '../img/4.jpg',
                });
                slides.push({
                    image: '../img/5.png',
                });
            };
            $scope.addSlide();
        });
    </script>
</body>
</html>

阅读更多
个人分类: 初步学习
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

用AngularJs做一个大图轮播

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭