Ctrl 키와 함께 클릭될 땐, 설정한 키이벤트가 발생 안되게 하려면? 채택완료
https://sir.kr/g4_tiptech/30590">https://sir.kr/g4_tiptech/30590
위 팁 참고해 c키가 눌러질 때, 특정게시판으로 이동되게 설정했어요.
</p>
<p>case 67: // c (css)
window.location = "<?php echo G5_URL.'/b/css';?>";
return false;</p>
<p>
그런데, Ctrl + C (글복사) 할 때도 이동되는 바람에 복사가 먹통. ㅜㅜ
그래서, Ctrl키가 눌린 상태에서는 함수 작동이 안 되게 하려는데...
함수 안 위쪽에 아래처럼 넣어봤는데 안 되더라구요.
</p>
<p>if(keyCode == 17 && keyCode == 67) return;</p>
<p>
ps.
키코드 조회
https://www.w3.org/2002/09/tests/keys.html">https://www.w3.org/2002/09/tests/keys.html
https://keycode.info/">https://keycode.info/
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
6년 전
특수키 관련 플래그 입니다.
$('#someelement').bind('click', function(event){
if(event.ctrlKey) {
if (event.ctrlLeft) {
console.log('ctrl-left');
}
else {
console.log('ctrl-right');
}
}
if(event.altKey) {
if (event.altLeft) {
console.log('alt-left');
}
else {
console.log('alt-right');
}
}
if(event.shiftKey) {
if (event.shiftLeft) {
console.log('shift-left');
}
else
{
console.log('shift-right');
}
}
});
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
s
6년 전
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인전체 질문 목록
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
채택
답변대기
답변대기
답변대기
답변대기
채택
채택
답변대기
답변대기
답변대기
채택
덕분에 잘 해결했습니다.
사랑합니다. ^ ! ~