diff --git a/frame.js b/frame.js index abcb997d..698bd067 100644 --- a/frame.js +++ b/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) { - 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"}}) }) }) diff --git a/plugin/input.js b/plugin/input.js index 71e41e32..1bb90248 100644 --- a/plugin/input.js +++ b/plugin/input.js @@ -43,11 +43,23 @@ Volcanos("onaction", {help: "控件交互", list: [], }, onkeydown: function(event, can) { 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) { + 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": + 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") { break }