angular js轮播图 (Carousel (ui.bootstrap.carousel))

代码转自http://angular-ui.github.io/bootstrap/,有修改,加注释:


html

<div class="row rollpic-div" style="height: 540px">
    <div class="inner">
                    
         <div style="height: 540px">
            <div>
                <uib-carousel interval="myInterval" no-wrap="false">
                    <uib-slide ng-repeat="slide in slides" active="slide.active">
                        <img ng-src="{{slide.image}}" style="margin:auto;">
                        <div class="carousel-caption button-caption">
                            <a href="/dhc/submit" class="roll_button">立即体验</a>
                        </div>
                    </uib-slide>


                </uib-carousel>


            </div>
        </div>
    </div>
  </div>

css

.carousel-control {
    display: none;
}

.carousel-caption {
text-shadow: none;
}


js

var app = angular.module('dhc');
app.registerController('indexController', function ($scope)//indexController见router.js
{    
	$scope.myInterval = 3000;//循环间隔 3s
  	//$scope.noWrapSlides = false;//是否循环
  	var slides = $scope.slides = [];//初始化

  	 $scope.totop = function() 
  		{
         //javascript:
         window.scrollTo(0,0);

      }

      /*  var newWidth = 600 + slides.length + 1;
    		slides.push
    		({
      			image: '//placekitten.com/' + newWidth + '/300',
     			text: ['More','Extra','Lots of','Surplus'][slides.length % 4] + ' ' + ['Cats', 'Kittys', 'Felines', 'Cutes'][slides.length % 4]
    		});
 		};
  for (var i=0; i<4; i++)
  	{
    	$scope.totop();
	}*/
slides.push({image: __uri('./images/index_3.png')});//js里要用__uri,最终线上fis才能将其转化成绝对路径/statics/的形式

slides.push({image: __uri('./images/index_12.png')});
});



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Achieve awesome user experiences and performance with simple, maintainable code! Embrace the full stack of web development, from styling with Bootstrap, building an interactive user interface with Angular 2, to storing data quickly and reliably in PostgreSQL. With this fully revised new edition, take a holistic view of full-stack development to create usable, high-performing applications with Rails 5. Rails is a great tool for building web applications, but it's not the best at everything. Embrace the features built into your database. Learn how to use front-end frameworks. Seize the power of the application stack through Angular 2, Bootstrap, and PostgreSQL. When used together, these powerful and easy-to-use tools will open you to a new world of possibilities. This second edition is updated to cover Angular 2 - a completely reworked front-end framework - and dives into new Postgres 9.5 features such as UPSERT. Also new is Webpack coverage, to develop the front-end code for your Rails application. Create a usable and attractive login form using Bootstrap's styles, while ensuring the database table backing it is secure using Postgres' check constraints. See how creating an advanced Postgres index for a case-insensitive search speeds up your back end - enabling you to create a dynamic user experience using Angular 2. Create reusable components that bring Bootstrap and Angular together and effectively use materialized views for caching within Postgres. Get your front end working with Webpack, use Postgres' features from migrations, and write unit tests for all of it. All of this within Rails 5. You'll gain the confidence to work at every level of the application stack, bringing the right solution to every problem. What You Need: This book covers Postgres 9.5, Rails 5, and Ruby 2.3. You should have some experience with basic Rails concepts and a cursory understanding of JavaScript, CSS, and SQL, but by no means need to be an expert. You'll learn how to install Postgres on your computer or use a free version of it in the cloud. Table of Contents Chapter 1. Set Up the Environment Chapter 2. Create a Great-Looking Login with Bootstrap and Devise Chapter 3. Secure the User Database with Postgres Constraints Chapter 4. Perform Fast Queries with Advanced Postgres Indexes Chapter 5. Create Clean Search Results with Bootstrap Components Chapter 6. Build a Dynamic UI with AngularJS Chapter 7. Test This Fancy New Code Chapter 8. Create a Single-Page App Using Angular's Router Chapter 9. Design Great UIs with Bootstrap's Grid and Components Chapter 10. Cache Complex Queries Using Materialized Views Chapter 11. Asynchronously Load Data from Many Sources Chapter 12. Wrangle Forms and Validations with Angular Chapter 13. Dig Deeper Appendix A1. Full Listing of Customer Detail Page HTML Appendix A2. Creating Customer Address Seed Data Appendix A3. How Webpack Affects Deployment

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值