这篇文章主要介绍了如何使用ionic播放轮询广告,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
代码示例:
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset="utf-8">
<title>ionic-demo</title>
<link href="../lib/ionic/css/ionic.css" rel="external nofollow" rel="stylesheet">
<script type="text/javascript" src="../lib/ionic/js/ionic.bundle.js" charset="utf-8"></script>
<style type="text/css">
div.box{
width: 100%;
height: 320px;
}
div.box > img{
width: 100%;
height: 100%;
}
</style>
</head>
<body ng-controller="ctrl">
<ion-view>
<ion-content>
<ion-slide-box on-slide-changed="slideHasChanged($index)" auto-play="true" does-continue="true" slide-interval=2000 show-pager="true" pager-click="pageClick(index)" active-slide="model.activeIndex" delegate-handle="delegateHandler">
<ion-slide>
<div class="box blue" ui-sref="list" >
<img src="https://cache.tdyun.com/upload/information/20200622/114/74864.jpg">
</div>
</ion-slide>
<ion-slide>
<div class="box yellow">
<img src="https://cache.tdyun.com/upload/information/20200622/114/74865.jpg/w640h420z1l50t1c70.jpg">
</div>
</ion-slide>
<ion-slide>
<div class="box pink">
<img src="https://ks.sinaimg.cn/n/news/20161003/d-TL-fxwkzym7587820.jpg/w640h420z1l50t18b4.jpg">
</div>
</ion-slide>
</ion-slide-box>
</ion-content>
</ion-view>
<script type="text/javascript">
var app = angular.module('app',['ionic']);
app.controller('ctrl', function($scope,$ionicSlideBoxDelegate,$state) {
//为了验证属性active-slide定义的模型,angularjs是mvc模式
$scope.model = {
activeIndex:1
};
//此事件对应的是pager-click属性,当显示图片是有对应数量的小圆点,这是小圆点的点击事件
$scope.pageClick = function(index){
$scope.model.activeIndex = 2;
};
//当图片切换后,触发此事件
$scope.slideHasChanged = function($index){
};
//这是属性delegate-handle的验证使用的,其实没必要重定义,直接使用$ionicSlideBoxDelegate就可以
$scope.delegateHandle = $ionicSlideBoxDelegate;
})
</script>
</body>
</html>
感谢你能够认真阅读完这篇文章,希望小编分享的“如何使用ionic播放轮询广告”这篇文章对大家有帮助,同时也希望大家多多支持天达云,关注天达云行业资讯频道,更多相关知识等着你来学习!