마우스 우클릭
터치패드 손가락 2개
마우스 우클릭
터치패드 손가락 2개
1. homebrew 설치 - 3.0.0부터 실리콘 맥 지원
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. jdk 설치
// 최신버전
brew install --cask adaptopenjdk
// 특정버전 - 버전정보는 여기서 확인 https://github.com/AdoptOpenJDK/homebrew-openjdk
brew tap AdoptOpenJDK/openjdk
brew install --cask <version>
3. nvm 설치
// C++ 컴파일러와 개발 라이브러리 사전 설치
sudo apt install build-essential libssl-dev
sudo yum install gcc gcc-c++ openssl-devel
// curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
// wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
// node.js 특정버전 설치 - 15부터 실리콘 맥을 지원한다
nvm install <version>
// C++ 부터 안되서 그냥 깔았다
brew install node
4. Visual Stuio Code
brew install --cask visual-studio-code
5. Jetbrain Toolbok - IntelliJ, Webstorm, Android Studio etc....
// toolbox
brew install --cask jetbrains-toolbox
// intellij
brew install --cask intellij-idea
// webstorm
brew install --cask webstorm
// intellij community
brew install --cask intellij-idea-ce
// android stuidio
brew install --cask android-studio
| 옛날 홈페이지라 메뉴가 어도비 플래시파일인 swf로 되어있고 사이트맵이 없어서 링크를 확인할 수 없는 곳 (0) | 2021.04.15 |
|---|---|
| 윈도우즈 서버에서 ip차단하는 방법 (0) | 2021.04.12 |
| WD my cloud에 설치한 Transmission의 속도가 급격히 저하되었을때 (0) | 2017.05.28 |
| LG-5000P에 나스 붙이는 법 (0) | 2015.08.07 |
| SONY NWZ-W273 초기화(포맷)하는법 (0) | 2015.07.22 |
a {
position: relative;
color: #000;
text-decoration: none;
}
a:hover {
color: #000;
}
a::before {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
left: 0;
background-color: #000;
visibility: hidden;
transform: scaleX(0);
transition: all 0.3s ease-in-out 0s;
}
a:hover::before {
visibility: visible;
transform: scaleX(1);
}
출처: tobiasahlin.com/blog/css-trick-animating-link-underlines/
1. 선택자
// 기본
$(".box");
document.querySelector(".box"); // 첫번째만 반환함
document.querySelectorAll(".box"); // 모두 반환함 nodeList 형태라고 하는데 배열이라고 생각하면 편함
// find
var container = $(".container");
container.find(".box");
var container = document.querySelector(".container");
container.querySelector(".box");
2. 기능실행
$(".box").hide();
// 한개
document.querySelector(".box").style.display = "none";
// 여러개
document.querySelectorAll(".box").forEach(box => { box.style.display = "none" })
3. 탐색
$(".box").next();
$(".box").prev();
$(".box").parent();
var box = document.querySelector(".box");
box.nextElementSibling;
box.previousElementSibling;
box.parentElement;
4. 요소
// 요소 추가
$("<div/>");
$("<span/>");
document.createElement("div");
document.createElement("span");
// 요소에 텍스트 추가
var element = document.createElement("div");
element.textContent = "Text"
var text = document.createTextNode("div");
element.appendChild(text);
// 요소의 속성 수정
$(".button").text("New text");
document.querySelector(".button").textContent = "New text";
// 요소의 속성값 가져오기
$(".button").text();
document.querySelector(".button").textContent;
// 요소에 하위 요소 추가
$(".container").append($("<div/>"));
var element = document.createElement("div");
document.querySelector(".container").appendChild(element);
4. 이벤트 추가
// 기본
$(".button").click(function(e) { /* handle click event */ });
$(".button").mouseenter(function(e) { /* handle click event */ });
$(document).keyup(function(e) { /* handle key up event */ });
document.querySelector(".button").addEventListener("click", (e) => { /* ... */ });
document.querySelector(".button").addEventListener("mouseenter", (e) => { /* ... */ });
document.addEventListener("keyup", (e) => { /* ... */ });
// 동적으로 추가하는 요소에도 이벤트 추가
$(".search-container").on("click", ".search-result", handleClick); // 기존 요소와 추가될 요소까지
var searchElement = document.createElement("div");
document.querySelector(".search-container").appendChild(searchElement);
searchElement.addEventListener("click", handleClick); // 추가한 요소에 이벤트 추가하기
// Trigger
$(document).trigger("myEvent");
$(".box").trigger("myEvent");
document.dispatchEvent(new Event("myEvent"));
document.querySelector(".box").dispatchEvent(new Event("myEvent"));
5. Style (CSS)
// 하나라면
$(".box").css("color", "#000");
document.querySelector(".box").style.color = "#000";
// 여러개라면
$(".box").css({
"color": "#000",
"background-color": "red"
});
var box = document.querySelector(".box");
box.style.color = "#000";
box.style.backgroundColor = "red";
// Set all styles at once (and override any existing styles)
box.style.cssText = "color: #000; background-color: red";
// Class명 추가/삭제/토글
$(".box").addClass("focus");
$(".box").removeClass("focus");
$(".box").toggleClass("focus");
// 한개
var box = document.querySelector(".box");
box.classList.add("focus");
box.classList.remove("focus");
box.classList.toggle("focus");
// 여러개
var box = document.querySelector(".box");
box.classList.add("focus", "highlighted");
box.classList.remove("focus", "highlighted");
// 상호 베타적인 토글용 2개의 Class를 번갈아가며 써야 한다면
document.querySelector(".box").classList.replace("focus", "blurred");
// Class명을 가지고 있는지 확인
$(".box").hasClass("focus");
document.querySelector(".box").classList.contains("focus");
6. Document Ready
$(document).ready(function() {
// 소스
});
var ready = (callback) => {
if (document.readyState != "loading") callback();
else document.addEventListener("DOMContentLoaded", callback);
}
ready(() => {
// 소스
});
7. Ajax
$.ajax({
url: "data.json"
}).done(function(data) {
// ...
}).fail(function() {
// Handle error
});
fetch("data.json").then(data => {
// Handle data
}).catch(error => {
// Handle error
});
출처를 기반으로 다시 정리함
출처: tobiasahlin.com/blog/move-from-jquery-to-vanilla-javascript/
Cheat sheet for moving from jQuery to vanilla JavaScript
This reference guide will help you convert jQuery's most common patterns to vanilla JavaScript
tobiasahlin.com
| fetch로 file download (feat. express) (0) | 2023.05.15 |
|---|---|
| 정렬 sort (0) | 2021.04.01 |
| 키보드를 이용한 Input text 포커스 이동 (0) | 2021.03.15 |
| String to Date / Date to String (0) | 2020.12.17 |
| 숫자에 콤마와 언콤마를 편하게 (0) | 2016.06.27 |
방향키와 페이지 업다운 키를 이용하여 포커스 이동을 구현해보았다.
<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8">
<title>키보드를 이용한 포커스 이동</title>
</head>
<body>
<h1>키보드로 이동하기</h1>
<form name="frm">
<input name="a"><input name="b"><input name="c"><br>
<input name="a"><input name="b"><input name="c"><br>
<input name="a"><input name="b"><input name="c"><br>
<input name="a"><input name="b"><input name="c"><br>
<input name="a"><input name="b"><input name="c"><br>
<input name="a"><input name="b"><input name="c"><br>
<input name="a"><input name="b"><input name="c"><br>
<input name="a"><input name="b"><input name="c"><br>
<input name="a"><input name="b"><input name="c"><br>
<input name="a"><input name="b"><input name="c"><br>
<input name="a">
<button>전송</button>
</form>
</body>
<script>
const inputs = document.querySelectorAll("input");
const total = inputs.length;
const cols = 3; // 컬럼수
//const rows = Math.ceil(total/cols); // 줄수
function keyevent(event) {
const keycode = event.keyCode;
const idx = Array.from(document.querySelectorAll('input')).indexOf(event.target);
switch (keycode) {
case (13) : // Enter
if(idx===(total-1)){ //enter
//alert("폼 전송");
}else{
document.querySelectorAll('input')[idx+1].focus();
}
break;
case(33) : // PageUp
document.querySelectorAll('input')[0].focus();
break;
case(34) : // PageDown
document.querySelectorAll('input')[total-1].focus();
break;
case(37) : // Left
if(idx===0){
return false;
}else{
document.querySelectorAll('input')[idx-1].focus();
}
break;
case(38) : // Up
if(idx < cols){
return false;
}else{
document.querySelectorAll('input')[idx-cols].focus();
}
break;
case(39) : // Right
if(idx===(total-1)){
return false;
}else{
document.querySelectorAll('input')[idx+1].focus();
}
break;
case (40) : // Down
if(idx+cols >= total){
return false;
}else{
document.querySelectorAll('input')[idx+cols].focus();
}
break;
default :
return false;
break;
}
}
function formCheck(e) {
// 문제가 있으면
// e.preventDefault();
}
document.querySelector("form").addEventListener('submit', formCheck);
for(const item of inputs) {
item.addEventListener('keydown', keyevent);
}
</script>
</html>
| 정렬 sort (0) | 2021.04.01 |
|---|---|
| jQuery to VanillaJS (0) | 2021.03.16 |
| String to Date / Date to String (0) | 2020.12.17 |
| 숫자에 콤마와 언콤마를 편하게 (0) | 2016.06.27 |
| 정규식으로 괄호 안의 문자 추출과 치환하기 (0) | 2015.07.09 |