PhoneGap中文网
标题:
怎么设置slidebox默认显示哪张图片
[打印本页]
作者:
foolishfox
时间:
2015-11-16 16:13
标题:
怎么设置slidebox默认显示哪张图片
<ion-content
ng-init=
"
initGallery
()"
style=
"
background-color
: grey
;
"
>
<ion-slide-box
show-pager=
"false"
>
<ion-slide
ng-repeat=
"
file
in
fileList
"
>
<div
ng-if=
"
slideVisible
($index)"
style=
"
width
:
100
%
;
height
:
100
%
;
background-color
: black
;
"
>
<ion-scroll
style=
"
width
:
100
%
;
height
:
100
%
;
background-color
: black
;
"
zooming=
"true"
min-zoom=
"1"
direction=
"xy"
locked=
"false"
>
<div
style=
"
width
:
100
%
;
height
:
600
px
;
background-size
: contain
;
background-repeat
:no-repeat
;
background-position
: center
,
center
;
background-image
:
url
(
{{
file
.
path
}}
)
"
></div>
</ion-scroll>
</div>
<div
class=
"item item-divider"
>
{{
file
.
name
}}
</div>
</ion-slide>
</ion-slide-box>
</ion-content>
控制层
appCtrls
.
controller
(
'viewImageCtrl'
,
function
($scope
,
$state
,
$stateParams
,
$ionicSlideBoxDelegate
,
localStorageService) {
$scope.
initGallery
=
function
() {
$scope.
fileList
= localStorageService.
getLocalStorage
(
"files"
)
;
$scope.
folderName
=$stateParams.
folderName
;
console.
log
(
"images are:"
+
angular
.
toJson
($scope.
fileList
))
;
$scope.
slideVisible
=
function
(index){
if
( index < $ionicSlideBoxDelegate.currentIndex() -
1
|| index > $ionicSlideBoxDelegate.currentIndex() +
1
){
return false
;
}
return true
;
}
}
})
请问设置slidebox,让它默认显示我想要的那一页
作者:
你懂的
时间:
2015-11-16 16:36
默认是第一页的,设置你想要的一页可以通过
ionicSlideBoxDelegate实现
作者:
foolishfox
时间:
2015-11-17 09:30
测试一把 发表于 2015-11-16 16:36
默认是第一页的,设置你想要的一页可以通过
ionicSlideBoxDelegate实现
找了半天官网也没找到设置方法
欢迎光临 PhoneGap中文网 (http://bbs.phonegap100.com/)
Powered by Discuz! X3.2