回答編集履歴

2

背景「色」変更機能追加

2015/12/22 16:33

投稿

ipadcaron
ipadcaron

スコア1693

test CHANGED
@@ -46,6 +46,8 @@
46
46
 
47
47
  var tds = $("td");
48
48
 
49
+ var counter = 1;
50
+
49
51
  var width=[100, 0];
50
52
 
51
53
  setInterval(function() {
@@ -64,6 +66,10 @@
64
66
 
65
67
  flag = false;
66
68
 
69
+ $("iframe", tds[0]).attr("src", "main.html?" + counter);
70
+
71
+ counter += 1;
72
+
67
73
  }
68
74
 
69
75
  } else {
@@ -78,10 +84,16 @@
78
84
 
79
85
  flag = true;
80
86
 
87
+ $("iframe", tds[1]).attr("src", "main.html?" + counter);
88
+
89
+ counter += 1;
90
+
81
91
  }
82
92
 
83
93
  }
84
94
 
95
+ if (counter > 8) counter = 1;
96
+
85
97
  }, 100);
86
98
 
87
99
  }
@@ -174,8 +186,6 @@
174
186
 
175
187
  </table>
176
188
 
177
-
178
-
179
189
  ```
180
190
 
181
191
  ↑追記、frameset は幅を変更できなかったので、iframe に変更する。

1

フレーム幅を変更するワイプデモを掲示

2015/12/22 16:33

投稿

ipadcaron
ipadcaron

スコア1693

test CHANGED
@@ -1,3 +1,195 @@
1
+ ```html
2
+
3
+ <script src="jquery.js"></script>
4
+
5
+ <script>
6
+
7
+ var s = location.search.split("?");
8
+
9
+ // M = Main html & timer start !!
10
+
11
+ // 1-9 = sub.html & background-colors valiations.
12
+
13
+ window.onload = function() {
14
+
15
+ console.log("OK:" + s[1]);
16
+
17
+ var t = document.getElementById("tbl");
18
+
19
+ console.log("td length = " + $("td", t).length);
20
+
21
+ if (s[1] == "M") {
22
+
23
+ t.style.display = "block";
24
+
25
+ wipe();
26
+
27
+ } else {
28
+
29
+ t.style.display = "none";
30
+
31
+ var o = document.getElementById("ID_" + s[1]);
32
+
33
+ if (o != null) {
34
+
35
+ o.style.display = "block";
36
+
37
+ }
38
+
39
+ }
40
+
41
+ }
42
+
43
+ function wipe() {
44
+
45
+ var flag = true;
46
+
47
+ var tds = $("td");
48
+
49
+ var width=[100, 0];
50
+
51
+ setInterval(function() {
52
+
53
+ console.log(tds.length + " :: " + width);
54
+
55
+ if (flag) {
56
+
57
+ if (width[0] > 0) {
58
+
59
+ $(tds[0]).css("width", (width[0]--) + "%");
60
+
61
+ $(tds[1]).css("width", (width[1]++) + "%");
62
+
63
+ } else {
64
+
65
+ flag = false;
66
+
67
+ }
68
+
69
+ } else {
70
+
71
+ if (width[0] < 100) {
72
+
73
+ $(tds[0]).css("width", (width[0]++) + "%");
74
+
75
+ $(tds[1]).css("width", (width[1]--) + "%");
76
+
77
+ } else {
78
+
79
+ flag = true;
80
+
81
+ }
82
+
83
+ }
84
+
85
+ }, 100);
86
+
87
+ }
88
+
89
+ </script>
90
+
91
+ <style>
92
+
93
+ html,body {
94
+
95
+ width:100%;
96
+
97
+ height:100%;
98
+
99
+ margin:0;
100
+
101
+ padding: 0;
102
+
103
+ overflow:hidden;
104
+
105
+ }
106
+
107
+ div {
108
+
109
+ width: 100%;
110
+
111
+ height: 100%;
112
+
113
+ display: none;
114
+
115
+ }
116
+
117
+ table {
118
+
119
+ width: 100%;
120
+
121
+ height: 100%;
122
+
123
+ display: none;
124
+
125
+ }
126
+
127
+
128
+
129
+ </style>
130
+
131
+ <div id="ID_1" style="background-color:pink;">
132
+
133
+ </div>
134
+
135
+ <div id="ID_2" style="background-color:gray;">
136
+
137
+ </div>
138
+
139
+ <div id="ID_3" style="background-color:lime;">
140
+
141
+ </div>
142
+
143
+ <div id="ID_4" style="background-color:yellow;">
144
+
145
+ </div>
146
+
147
+ <div id="ID_5" style="background-color:magenta;">
148
+
149
+ </div>
150
+
151
+ <div id="ID_6" style="background-color:green;">
152
+
153
+ </div>
154
+
155
+ <div id="ID_7" style="background-color:tomato;">
156
+
157
+ </div>
158
+
159
+ <div id="ID_8" style="background-color:#CCC;">
160
+
161
+ </div>
162
+
163
+
164
+
165
+ <table id="tbl">
166
+
167
+ <tr>
168
+
169
+ <td width="99%"><iframe id="leftFrame" src="main.html?1" style="width: 100%; height: 100%" frameborder="no"></iframe></td>
170
+
171
+ <td width="1%"><iframe id="rightFrame" src="main.html?2" style="width: 100%; height: 100%" frameborder="no"></iframe></td>
172
+
173
+ </tr>
174
+
175
+ </table>
176
+
177
+
178
+
179
+ ```
180
+
181
+ ↑追記、frameset は幅を変更できなかったので、iframe に変更する。
182
+
183
+ PCでもカクカクしますね。
184
+
185
+ ページをめくる、ような動きをさせたいのでしょうけど、これ重いからやめて、フェードIN,OUT にしたら
186
+
187
+ どうですか。
188
+
189
+
190
+
191
+ -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
192
+
1
193
  <frameset cols="100%,0%">
2
194
 
3
195
  <frame src="left.html?1" />