用ionic实现无限轮播与点击跳转
程序员文章站
2022-04-11 14:26:49
...
第一页面
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <link rel="stylesheet" href="../lib/css/ionic.css"> <script src="../lib/js/ionic.bundle.min.js"></script> <script> var app = angular.module('myApp', ['ionic']); app.config(function($stateProvider,$urlRouterProvider) {/*$urlRouterProvider*/ $stateProvider .state('home', { url: '/', templateUrl: 'home.html' }) .state('tiaozhuan', { url: '/tiaozhuan', templateUrl: 'tiaozhuan.html' }) $urlRouterProvider.otherwise("/") }); </script></head><body ng-app="myApp"><ion-nav-view animation="slide-left-right"> <!-- 中间内容 --></ion-nav-view></body></html>
第二页面<!DOCTYPE html><html lang="en"><head>
<meta charset="UTF-8">
<title>Title</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../lib/css/ionic.min.css">
<script src="../lib/js/ionic.bundle.min.js"></script>
<style>
img{
width: 100%;
height: auto;
}
.btn{
background: green;
position: fixed;
left: 40%;
bottom: 100px;
}
</style>
<script>
var my=angular.module("my",["ionic"]);
</script></head><body ng-app="my">
<!-- ion-view的标题会在导航栏显示 -->
<ion-view title="Tiaozhuan">
<ion-content>
<ion-nav-view animation="slide-left-right">
<ion-slide-box auto-play="true" does-continue="true" slide-interval="1500">
<ion-slide>
<p class="box blue"><img src="../img/start_page-01.jpg" height="1334" width="750"/></p>
</ion-slide>
<ion-slide>
<p class="box yellow"><img src="../img/start_page-02.jpg" height="1334" width="750"/></p>
</ion-slide>
<ion-slide on-slide-changed="slideHasChanged(index)">
<p class="box pink">
<img src="../img/start_page-03.jpg" height="1334" width="750"/>
<button class="button button-balanced btn" ui-sref="tiaozhuan">点击进入</button>
</p>
</ion-slide>
</ion-slide-box>
</ion-nav-view>
</ion-content></ion-view>
</body>
</html>
第三页面
<!-- ion-view的标题会在导航栏显示 --><ion-view title="Tiaozhuan">
<ion-content>
<p>asdas</p>
</ion-content></ion-view>
以上就是用ionic实现无限轮播与点击跳转的详细内容,更多请关注其它相关文章!
上一篇: 在Angular组件中引入外部样式的方法
下一篇: layui分页效果实现代码分享