質問編集履歴
2
余分な部分を削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -110,34 +110,6 @@
|
|
110
110
|
|
111
111
|
return width;
|
112
112
|
|
113
|
-
},
|
114
|
-
|
115
|
-
destroyItemScope: function(index, scope) {
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
if ($scope.searchList) {
|
120
|
-
|
121
|
-
for (var i = 0, listLength = $scope.searchList.length; i < listLength; i++) {
|
122
|
-
|
123
|
-
var data = $scope.searchList[i];
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
var element = document.getElementById(data.dataid);
|
128
|
-
|
129
|
-
if (element) {
|
130
|
-
|
131
|
-
element.style.top = "initial";
|
132
|
-
|
133
|
-
element.style.position = "initial";
|
134
|
-
|
135
|
-
}
|
136
|
-
|
137
|
-
}
|
138
|
-
|
139
|
-
}
|
140
|
-
|
141
113
|
}
|
142
114
|
|
143
115
|
};
|
1
ソースを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -21,3 +21,181 @@
|
|
21
21
|
|
22
22
|
|
23
23
|
http://rfs.jp/sb/html/html-css-lab/flexbox_propaty.html
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
2017/08/10 ソースを追加しました。
|
30
|
+
|
31
|
+
ソースは以下の通りです。
|
32
|
+
|
33
|
+
```HTML
|
34
|
+
|
35
|
+
<ons-page id="search_list_main" ng-controller="searchListController as listSearch">
|
36
|
+
|
37
|
+
<ons-toolbar fixed-style="true">
|
38
|
+
|
39
|
+
<div class="left">
|
40
|
+
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div class="center search_list-title-center">リスト</div>
|
44
|
+
|
45
|
+
<div class="right"></div>
|
46
|
+
|
47
|
+
</ons-toolbar>
|
48
|
+
|
49
|
+
<div>
|
50
|
+
|
51
|
+
<div class="search_list-item-div">
|
52
|
+
|
53
|
+
<div class="search_list" id="search_list-item-id" style="">
|
54
|
+
|
55
|
+
<div ons-lazy-repeat="listSearch.delegateSpot">
|
56
|
+
|
57
|
+
{{item}}
|
58
|
+
|
59
|
+
</div>
|
60
|
+
|
61
|
+
</div>
|
62
|
+
|
63
|
+
</div>
|
64
|
+
|
65
|
+
</div>
|
66
|
+
|
67
|
+
</ons-page>
|
68
|
+
|
69
|
+
```
|
70
|
+
|
71
|
+
```JavaScript
|
72
|
+
|
73
|
+
//razy-repeatの部分のみ抽出
|
74
|
+
|
75
|
+
/* lazy_repeatの制御 */
|
76
|
+
|
77
|
+
this.delegateSpot = {
|
78
|
+
|
79
|
+
createItemContent : function(index, oldContent) {
|
80
|
+
|
81
|
+
var listData = $scope.searchList[index];
|
82
|
+
|
83
|
+
return ons._util.createElement(
|
84
|
+
|
85
|
+
"<div class='search_list-item' id='"+ listData.dataid + "'"
|
86
|
+
|
87
|
+
+ " ng-click='clickData(" + listData.datano + ")'"
|
88
|
+
|
89
|
+
+ " style='height:" + imageHeight + "px'>"
|
90
|
+
|
91
|
+
+ " <img class='search_list-image' id='img-search-" + listData.datano + "' src='" + listData.image + "'>"
|
92
|
+
|
93
|
+
+ " </div>"
|
94
|
+
|
95
|
+
);
|
96
|
+
|
97
|
+
},
|
98
|
+
|
99
|
+
countItems: function() {
|
100
|
+
|
101
|
+
return $scope.searchList.length;
|
102
|
+
|
103
|
+
},
|
104
|
+
|
105
|
+
calculateItemHeight: function() {
|
106
|
+
|
107
|
+
var width = Math.round(window.innerWidth * 32 / 100) - 10;
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
return width;
|
112
|
+
|
113
|
+
},
|
114
|
+
|
115
|
+
destroyItemScope: function(index, scope) {
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
if ($scope.searchList) {
|
120
|
+
|
121
|
+
for (var i = 0, listLength = $scope.searchList.length; i < listLength; i++) {
|
122
|
+
|
123
|
+
var data = $scope.searchList[i];
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
var element = document.getElementById(data.dataid);
|
128
|
+
|
129
|
+
if (element) {
|
130
|
+
|
131
|
+
element.style.top = "initial";
|
132
|
+
|
133
|
+
element.style.position = "initial";
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
};
|
144
|
+
|
145
|
+
```
|
146
|
+
|
147
|
+
```CSS
|
148
|
+
|
149
|
+
.search_list {
|
150
|
+
|
151
|
+
position: absolute;
|
152
|
+
|
153
|
+
z-index: -1;
|
154
|
+
|
155
|
+
overflow-x: none;
|
156
|
+
|
157
|
+
display : -webkit-flex;
|
158
|
+
|
159
|
+
display : flex;
|
160
|
+
|
161
|
+
justify-content: flex-start;
|
162
|
+
|
163
|
+
-webkit-justify-content: flex-start;
|
164
|
+
|
165
|
+
flex-wrap: wrap;
|
166
|
+
|
167
|
+
-webkit-flex-wrap: wrap;
|
168
|
+
|
169
|
+
align-items: stretch;
|
170
|
+
|
171
|
+
-webkit-align-items: stretch;
|
172
|
+
|
173
|
+
flex-direction: row;
|
174
|
+
|
175
|
+
-webkit-flex-direction: row;
|
176
|
+
|
177
|
+
width : 100%;
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
.search_list-item {
|
182
|
+
|
183
|
+
display : table-cell;
|
184
|
+
|
185
|
+
width : 32%;
|
186
|
+
|
187
|
+
height: 250px;
|
188
|
+
|
189
|
+
padding-bottom: 5px;
|
190
|
+
|
191
|
+
padding-right: 6px;
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
.search_list-item:nth-child(3n) {
|
196
|
+
|
197
|
+
padding-right: 0px;
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
```
|