제이쿼리5 TOP버튼 / 누르면 맨 위로 올라가는 버튼 / scroll top / 스크롤 내리면 나타나는 버튼 $(document).ready(function () { // 1. 특정 위치에서 부터 버튼 나타고, 사라지게..효과는 fade로 $(window).scroll(function () { if ($(this).scrollTop() > 200) { $('.go-top').fadeIn(200); } else { $('.go-top').fadeOut(200); } }); // 2. 버튼 클릭하면 원하는 위치로 이동 $('.go-top').click(function (event) { event.preventDefault(); $('html, body').animate({ scrollTop: 0 }, 300); }); }); [1] 스크롤이 200보다 크다면 .go-top버튼을 fadeIn하고, 아니라면 fadeO.. 2020. 7. 28. [jQuery] if, else if, else 사용법 if A1을 만족하면 description1 실행 if ('A1') { description1 } if, else A1을 만족하면 description1 실행, 아니라면 description2 실행 if('A1') { description1 } else { description2 } if, else if, else A1을 만족하면 description1 실행, A2을 만족하면 description2 실행, 둘 다 만족하지 못하면 description3을 실행 if('A1') { description1 } else if('A2') { description2 } else { description3 } [예제] if, else ex) div에 B가 있다면 C에 C0를 추가하고 없다면 C1를 추가합니다. $(d.. 2020. 7. 8. [Jquery]레이어팝업 "오늘은 그만보기 / 닫기" 버튼 제이쿼리 [결과보기 - 캡쳐] 1 - html 1 1 1 2 2 2 3 3 3 4 4 4 오늘은 그만보기 닫기 2 - CSS .wrap {min-width:1200px; margin:0 auto; position:relative;} #popup {position:absolute; top:100px; left:50%; transform:translateX(-50%); z-index:1000; width:500px; height:500px; background:pink; display:none;} table {width:350px; table-layout:fixed; text-align:center;margin:180px auto 0;} table tr th { background:#eee;} table tr td .. 2020. 2. 20. [javascript, jquery] 조건문 => 부등호연산자 부등호 연산자 + 더하기 - 빼기 * 곱하기 / 나누기 % 나누고 남은 수 ++ 값 + 1 -- 값 - 1 [ex] a=10, b=5, c=결과 라고 가정했을 때 + | 더하기 | c=a+b | 15 - | 빼기 | c=a-b | 5 * | 곱하기 | c=a*b | 50 / | 나누기 | c=a/b | 2 % | 나누고 남은 수 | c=a/b | 0 ++ | 값 + 1 | c=++a | 11 -- | 값 - 1 | c=--a | 9 > ~보다 크다 = ~보다 크거나 같다 2 | d는 2보다 크다 | true d = 20 | d는 20보다 크거나 같다 | false d 1(a은 20 보다 작고 '그리고' b는 1보다 크다) | true ||.. 2019. 12. 4. 이전 1 2 다음 반응형