본문 바로가기

js

(62)
js 2022. 11. 9. 10:43
[js]append 여러개 (자바스크립트) let wrap = document.getElementById("wrap"); let count = 4; for(i=0;i
js 2022. 11. 8. 09:27
[js]스크롤 애니메이션 IntersectionObserver See the Pen Untitled by sangmok-ye (@sangmok-ye) on CodePen. IntersectionObserver는 비동기 intersectionRatio == 0 → isIntersecting : false 0 < intersectionRatio last-child가 보이면 추가해줌 See the Pen IntersectionObserver 무한스크롤 by sangmok-ye (@sangmok-ye) on CodePen. const ul = document.getElementById("container") const options = { threshold: 1, // target이 모두 보이면 실행 } const ioLast = new IntersectionObserve..
js 2022. 11. 3. 11:05
[js]if문 배열로 쓰기 const txt = "naver" if(txt=="naver"){ console.log("네이버") }else if(txt=="daum"){ console.log("다음") }else if(txt=="payco"){ console.log("페이코") }else if(txt=="nate"){ console.log("네이트") }else{ console.log("해당없음") } // ====================================== const array = { "naver":"네이버", "daum":"다음", "payco":"페이코", "nate":"네이트" } function array_name(array_type){ if(array[array_type]){ return array[a..
js 2022. 10. 24. 15:35
[js]chart.js 차트 스크립트 See the Pen chart.js by sangmok-ye (@sangmok-ye) on CodePen. https://www.chartjs.org/docs/latest/ const custom = new Image(); custom.src = "https://cdn-icons-png.flaticon.com/128/4160/4160132.png"; // pointStyle: custom 으로 할경우 해당 url의 이미지로 변경됨 const x_val = ["1월","2월","3월","4월","5월","6월","7월"] const data = { labels: x_val, datasets:[{ label:"데이타셋", data:[10,100,25,80,50,85,15], pointStyle:"circl..
js 2022. 10. 21. 10:41
[js]숫자를 한글로 바꾸기 See the Pen 숫자를 한글로 by sangmok-ye (@sangmok-ye) on CodePen.
js 2022. 10. 11. 13:08
[js]e.stopPropagation()과 e.preventDefault() 레어어팝업 클릭 e.preventDefault()→ a링크 등과 같은 클릭이벤트를 강제로 무시하게 하는 스크립트e.stopPropagation()→ 버블링 무시하는 스크립트→ 레이어팝업에서 비지를 따로 설정하지않은 상태에서 활용가능 버블링이란,div>p>span 일 경우 각 태그에 얼럿이 걸려있을 경우, span을 클릭하면 span,p,div순으로 모든 온클릭이 실행되는 것을 의미함※ 버블링의 반대는 캡쳐링 : 제이쿼리로 캡쳐링은 불가능 onclick="event.stopPropagation()" ※ 온클릭 사용 시 button, input 등과 같이 클릭이벤트가 발생하는 태그 혹은 클릭이벤트가 있는 상태여야 버블링이 막힘See the Pen 레이어팝업 닫기 by sangmok-ye (@sangmok-ye) on C..
js 2022. 8. 29. 11:22
[js]숫자 카운트 카운팅 숫자 올라가는 제이쿼리 See the Pen Untitled by sangmok-ye (@sangmok-ye) on CodePen. 동시에 끝나는 카운팅 라이브러리 http://bfintal.github.io/Counter-Up/demo/demo.html Counter Up Demo Counter-Up jQuery Plugin (Scroll down) jQuery(document).ready(function($) { $('.counter').counterUp({ delay: 10, time: 1000 }); }); bfintal.github.io
js 2022. 8. 25. 09:56
[js] select 유지 시키기 See the Pen select 유지 by sangmok-ye (@sangmok-ye) on CodePen. text가 입력되어 있을 경우, 셀렉박스 변경 가능 text가 비어 있을 경우, 셀렉박스를 변경해도 변경 불가 option:selected에서 변경 불가 // $(".right_box").load(location.href+' .right_box select') 특정 영역만 새로고침도 가능

top