forked from x/volcanos
opt some
This commit is contained in:
parent
2b6e927085
commit
184828c3e7
4
frame.js
4
frame.js
@ -639,9 +639,9 @@ Volcanos("onkeypop", {help: "键盘交互", list: [], _init: function(can) {
|
|||||||
}}
|
}}
|
||||||
})}])
|
})}])
|
||||||
|
|
||||||
can.Timer({interval: 100}, function() {
|
can.Timer({interval: 1000}, function() {
|
||||||
can.page.Select(can, ui.high, "div.char", function(item) {
|
can.page.Select(can, ui.high, "div.char", function(item) {
|
||||||
item.offsetHeight > 0 && can.page.Modify(can, item, {style: {height: item.offsetHeight-4+"px"}})
|
item.offsetHeight > 0 && can.page.Modify(can, item, {style: {height: item.offsetHeight-1+"px"}})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -43,11 +43,23 @@ Volcanos("onaction", {help: "控件交互", list: [],
|
|||||||
},
|
},
|
||||||
onkeydown: function(event, can) {
|
onkeydown: function(event, can) {
|
||||||
event.key !== " " && can.page.Select(can, document.body, "div.char."+event.key, function(item) {
|
event.key !== " " && can.page.Select(can, document.body, "div.char."+event.key, function(item) {
|
||||||
can.page.Modify(can, item, {style: {height: item.offsetHeight+100+"px"}})
|
can.page.Modify(can, item, {style: {background: "rgb("
|
||||||
|
+parseInt(Math.random()*255)+","
|
||||||
|
+parseInt(Math.random()*255)+","
|
||||||
|
+parseInt(Math.random()*255)+")",
|
||||||
|
height: item.offsetHeight+100+"px"}})
|
||||||
})
|
})
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
|
case " ":
|
||||||
|
can.page.Select(can, document.body, "div.char", function(item) {
|
||||||
|
can.page.Modify(can, item, {style: {height: item.offsetHeight+100+"px"}})
|
||||||
|
})
|
||||||
|
break
|
||||||
case "Enter":
|
case "Enter":
|
||||||
|
event.key !== " " && can.page.Select(can, document.body, "div.char", function(item) {
|
||||||
|
can.page.Modify(can, item, {style: {height: 0+"px"}})
|
||||||
|
})
|
||||||
if (event.target.tagName == "TEXTAREA") {
|
if (event.target.tagName == "TEXTAREA") {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user