ionic slide box
ion-slide-box
The slide box is a component that contains a multi-page container, and each page can be switched by sliding or dragging:
The effect is as follows:
Usage
<ion-slide-box on-slide-changed="slideHasChanged($index)">
<ion-slide>
<div class="box blue"><h1>BLUE</h1></div>
</ion-slide>
<ion-slide>
<div class="box yellow"><h1>YELLOW</h1></div>
</ion-slide>
<ion-slide>
<div class="box pink"><h1>PINK</h1></div>
</ion-slide>
</ion-slide-box>
API
| Attributes | Type | Details |
|---|---|---|
|
delegate-handle
(Optional)
|
String
|
The handle is used |
|
does-continue
(Optional)
|
Boolean
|
Whether the slide box enables loop scrolling. |
|
auto-play
(Optional)
|
boolean
|
Set whether the slide box loops. If does-continue is true, the default is also true. |
|
slide-interval
(Optional)
|
Number
|
How many milliseconds to wait before starting to slide (true if it continues). The default is 4000. |
|
show-pager
(Optional)
|
Boolean
|
Whether the slide box's pager is displayed. |
|
pager-click
(Optional)
|
Expression
|
When a page is clicked, trigger this expression (if shou-pager is true). Pass an 'index' variable. |
|
on-slide-changed
(Optional)
|
Expression
|
When sliding, trigger this expression. Pass an 'index' variable. |
|
active-slide
(Optional)
|
Expression
|
Bind the model to the current slide box. |
Example
HTML Code
<ion-slide-box active-slide="myActiveSlide"> <ion-slide> <div class="box blue"><h1>BLUE</h1></div> </ion-slide> <ion-slide> <div class="box yellow"><h1>YELLOW</h1></div> </ion-slide> <ion-slide> <div class="box pink"><h1>PINK</h1></div> </ion-slide> </ion-slide-box>
CSS Code
.slider {
height: 100%;
}
.slider-slide {
color: #000;
background-color: #fff; text-align: center;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; font-weight: 300; }
.blue {
background-color: blue;
}
.yellow {
background-color: yellow;
}
.pink {
background-color: pink;
}
.box{
height:100%;
}
.box h1{
position:relative; top:50%; transform:translateY(-50%);
}
JavaScript Code
angular.module('ionicApp', ['ionic'])
.controller('SlideController', function($scope) {
$scope.myActiveSlide = 1;
})
Other Extensions