回答編集履歴
1
CSS・JSを含めて記載しなおしました。
answer
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
プルフックはプルフックとして画面上部に入れ
|
3
3
|
その下にカルーセルを配置、で良いのではないでしょうか?
|
4
4
|
|
5
|
+
公式の実例を組み合わせただけですが、以下の内容でカルーセル、プルフック共に動きました。スワイプ操作が競合してしまう、というのも無さそうです。
|
6
|
+
|
5
7
|
```HTML
|
6
8
|
<ons-page>
|
7
9
|
|
@@ -9,15 +11,68 @@
|
|
9
11
|
Pull to refresh
|
10
12
|
</ons-pull-hook>
|
11
13
|
|
14
|
+
<ons-carousel swipeable overscrollable auto-scroll fullscreen var="carousel">
|
12
|
-
|
15
|
+
<ons-carousel-item style="background-color: gray;">
|
13
|
-
|
16
|
+
<div class="item-label" id="A">A</div>
|
14
|
-
test
|
15
|
-
|
17
|
+
</ons-carousel-item>
|
16
|
-
|
18
|
+
<ons-carousel-item style="background-color: #085078;">
|
17
|
-
|
19
|
+
<div class="item-label" id="B">B</div>
|
18
|
-
|
20
|
+
</ons-carousel-item>
|
21
|
+
<ons-carousel-cover>
|
22
|
+
<div class="cover-label">Swipe left or right</div>
|
23
|
+
</ons-carousel-cover>
|
19
|
-
|
24
|
+
</ons-carousel>
|
20
25
|
|
21
26
|
</ons-page>
|
27
|
+
```
|
28
|
+
```css
|
29
|
+
ons-carousel-item {
|
30
|
+
display: table;
|
31
|
+
text-align: center;
|
32
|
+
}
|
22
33
|
|
34
|
+
.item-label {
|
35
|
+
display: table-cell;
|
36
|
+
vertical-align: middle;
|
37
|
+
color: white;
|
38
|
+
line-height: 1;
|
39
|
+
font-size: 48px;
|
40
|
+
font-weight: bold;
|
41
|
+
}
|
42
|
+
|
43
|
+
.cover-label {
|
44
|
+
text-align: center;
|
45
|
+
position: absolute;
|
46
|
+
left: 0px;
|
47
|
+
width: 100%;
|
48
|
+
bottom: 10px;
|
49
|
+
color: white;
|
50
|
+
}
|
51
|
+
```
|
52
|
+
```JS
|
53
|
+
ons.ready(function() {
|
54
|
+
var pullHook = document.getElementById('pull-hook');
|
55
|
+
|
56
|
+
pullHook.addEventListener('changestate', function(event) {
|
57
|
+
var message = '';
|
58
|
+
|
59
|
+
switch (event.state) {
|
60
|
+
case 'initial':
|
61
|
+
message = 'Pull to refresh';
|
62
|
+
break;
|
63
|
+
case 'preaction':
|
64
|
+
message = 'Release';
|
65
|
+
break;
|
66
|
+
case 'action':
|
67
|
+
message = 'Loading...';
|
68
|
+
break;
|
69
|
+
}
|
70
|
+
|
71
|
+
pullHook.innerHTML = message;
|
72
|
+
});
|
73
|
+
|
74
|
+
pullHook.onAction = function(done) {
|
75
|
+
setTimeout(done, 1000);
|
76
|
+
};
|
77
|
+
});
|
23
78
|
```
|