HTML
-> div 1 개로 진행
CSS
-> div width,height 와 img의 width,height 동일하게 설정
-> overflow 를 설정 X
-> img 의 transition X
JS
-> div의 위치값 사용 X
const 버튼이름1 = document.querySelector("버튼위치1");
const 버튼이름2 = document.querySelector("버튼위치2");
const images = document.querySelectorAll("div > img");
images.forEach(elmt => {elmt.style.display = "none";});
images[0].style.display = "";
버튼이름.addEventListener('click', 함수명);
images.forEach(elmt => {elmt.style.display = "none";});
const img = images[++current_index];
img.style.display = "";
const img = images[--current_index];
img.style.display = "";
img.style.opacity = "숫자"; // 광도 : 0 ~ 1
let increase = 0;
// let del = 0; // 감소값
const 함수명 = setInterval(function(){
increase += 0.005;
// del += 0.005;
img.style.opacity = `${Number(opc) + increase}`;
// img.style.opacity = `${Number(opc) - del}`;
// 주의 opc 는 string 타입!!
if(Number(img.style.opacity) == "1.0"){
// if(Number(img.style.opacity) == "0.3"){
clearInterval(함수명);
}
},10); // 10은 밀리초
slide : https://velog.io/@jjoung-2j/Javascript-Slide