1
0
forked from x/volcanos
This commit is contained in:
shylinux 2020-08-26 09:14:42 +08:00
parent 2b6e927085
commit 184828c3e7
2 changed files with 15 additions and 3 deletions

View File

@ -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"}})
}) })
}) })

View File

@ -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
} }