jquery 크로스 워드 퍼즐 플러그인에서 작업 중이며 iOS 버전의 경우 셀을 클릭하면 .focus()를 사용하는 함수가 호출됩니다. 터치 스크린 키보드. 편지 키를 누를 때 다음 셀로 이동하여 동일한 클릭 이벤트를 호출하고 입력 준비가되도록 설정 한 것입니다. 이것은 PC에서 잘 작동하지만 어떤 이유로 키를 누른 후에 불려질 때가 아니라 정기적 인 클릭이 키보드를 불러옵니다. 셀은 내부에 입력 태그가있는 div입니다.포커스가있는 iOS 키보드 가져 오기
이function cellClick(event)
{
moveToCell("#" + event.currentTarget.id);
_cwo.onWord = false;
var dir = getNewDirection(_cwo.currRow, _cwo.currCol);
_cwo.direction = dir;
alignClue("A", _cwo.clues["across"]);
alignClue("D", _cwo.clues["down"]);
};
function moveToCell(id) // put the cursor in the given cell
{
$(_cwo.currCell).css('background-color', 'white');
$(id).css('background-color', _cwo.currentCellColor);
_cwo.currRow = $(id).data('row');
_cwo.currCol = $(id).data('col');
_cwo.currCell = "#" + cellID(_cwo.currRow, _cwo.currCol);
$(_cwo.currCell).focus();
};
function keyUp(event)
{
if (event.currentTarget.tagName != "HTML") return;
if(event.which == 13){
var dir = getDirection(_cwo.currRow, _cwo.currCol);
if(dir == "across")goAcross(true);
else
goDown(true);
}
if (
(32 == event.which) ||
((64 < event.which) && (event.which < 91)) ||
((96 < event.which) && (event.which < 123))
)
{
_char = codeToChar(event.which);
if (_char == _cwo.NA) return;
$(_cwo.currCell).data('player', _char);
paintCell(_cwo.currCell, 'player');
if(_cwo.direction == 'across')goAcross(false);
if(_cwo.direction == 'down')goDown();
}
alignClue("A", _cwo.clues["across"]);
alignClue("D", _cwo.clues["down"]);
$("#" + cellID(_cwo.currRow, _cwo.currCol)).click(); //calls cellClick
};
//Will prevent keys from being repeated on input
$('*').keydown(function(e){
e.preventDefault();
});