작업 한 js
-
해당 위치에서 컨텐츠 고정작업 한 js 2024. 8. 2. 17:22
html style .fixed { position: fixed; bottom: 0; } 작동 되어 야 하는 기능스크롤 하면 fixed 클래스의 컨텐츠가 따라와야 하고원하는 위치에서 컨텐츠가 고정 되어야 함 1차 document.addEventListener("scroll", function () { const productsList = document.querySelector("#products-list"); const productItem = document.querySelector(".Nproduct"); let targetPosition = productsList.getBoundingClientRect().top..
-
자바스크립트 scorll작업 한 js 2024. 3. 19. 16:45
이미지를 클릭시 해당 위치로 이동 이미지에 스타일 적용 .gif-img {position: relative; margin-bottom:32px;} .gif-click{position: absolute; width: 100%; height: 20%; bottom: 0;} js 1번 const gifImg = document.querySelector(".gif-click"); const gifDocument = document.querySelector(".gif-img-content"); const gifDoc = gifDocument.offsetTop - 48; gifImg.onclick = function(){ window.scroll({top:gifDoc, behavior:'smooth}); } off..