전체 글 263

211006_div,click,hide,show

DOCTYPE html> Insert title here .red{color: red;} .green{color: green;} .blue{color: blue;} /* 그냥 b만 써도 되나 관계공부를 위해 */ /* div의 content red,green,blue를 한꺼번에 부를려면 공통단어인 content */ div.content>b{ cursor: pointer; font-family: 'Nanum Pen Script'; font-size: 25pt; } /* 그냥 h5로 해도 됨 */ div.answer>h5 { text-indent: 30px; /* 들여쓰기 */ } $(function() { //댓글숨기기 $("div.answer").hide(); //내용 클릭시 그 내용의 댓글만 보이고 ..

JQuery 2021.10.06

211005_fadeout,fadein

DOCTYPE html> Insert title here body,ul,li{ margin: 0px; padding: 0px; } div#logo { width: 250px; height: 130px; margin: 100px auto; cursor: pointer; } ul #list { width: 900px; margin: 50px auto; } li { list-style: none; float: left; cursor: pointer; width: 150px; height: 230px; margin-left: 50px; } //각각의 이미지 클릭시 사라지게 $("li img").click(function() { $(this).fadeOut(); }); //제목 누르면 다시 이미지 나타나게 하면서..

JQuery 2021.10.05

211005_siblings

DOCTYPE html> Insert title here 첫번째 div div하나 둘 셋 h3 Tag h4 Tag 두번째 div div하나 둘 셋 h3 Tag h4 Tag //parent():부모태그 //siblings():형제태그 //children():자식태그 //next():선택한 요소의 다음에 위치한 형제요소 //prev():선택한 요소의 바로 이전에 위치한 형제요소 $("div.one div.hana").siblings().css("color", "red"); $("div").children("div.hana").css("text-decoration", "underline"); $("div.hana").next().next().css("background-color", "yellow"); $("..

JQuery 2021.10.05

211005_transform,hover,rocate,scale,translate

DOCTYPE html> Insert title here //1번째 이미지 hover $("img:eq(0)").hover(function() { //45 회전..angle은 각크기, 단위는 deg,rad,grad,turn(1회전=360deg) $(this).css("transform", "rotate(180deg)"); }, function() { $(this).css("transform", "rotate(0deg)"); }) //2번째 이미지에 -45도 회전했다가 제자리 $("img:eq(1)").hover(function() { $(this).css("transform", "rotate(-45deg)"); }, function() { $(this).css("transform", "rotate(0de..

JQuery 2021.10.05

211005_form,change,click

DOCTYPE html> Insert title here div.right { position: absolute; left: 300px; border: 10px solid gray; padding: 20px; } 이미지 선택 이미지1 이미지2 이미지3 이미지4 이미지5 테두리선 선택 실선 점선 파선 입체선 박스그림자 그림자 넣기 //이미지 선택하면 change이벤트 $("#selImage").change(function() { //현재 내가 선택한 이미지 /* var im=$(this).val(); $("div.right img").attr("src", im); 아래처럼 한줄로도 가능*/ $("div.right img").attr("src", $(this).val()); }); //테두리선 선택시 cli..

JQuery 2021.10.05

211001_each,append,after

DOCTYPE html> Insert title here .bg_0{ background-color: orange; color: gray; } .bg_1{ background-color: lavender; color: purple; } .bg_2{ background-color: blue; color: white; } .bg_3{ background-color: green; color: white; } .bg_4{ background-color: pink; color: red; } ul li { width: 130px; } //b태그 개수만큼 자동반복 //i는 index 0부터 //element는 인덱스에 해당하는 b태그..생략가능 $("b").each(function(i, element) { $(thi..

JQuery 2021.10.01

211001_div,check,radio

DOCTYPE html> Insert title here div { border: 1px solid gray; padding: 20px 20px 20px 20px; width: 500px; margin-bottom: 10px; } 폼태그연습 #1 아이디 비밀번호 //input에 포커스가 갈 경우 배경색 $("input:text,input:password").focus(function() { $(this).css("background-color", "yellow"); }); //포커스가 벗어날 경우 다시 원래대로(흰색) $("input:text,input:password").blur(function() { $(this).css("background-color", "white"); }) 폼태그연습 #2 운전..

JQuery 2021.10.01

211001_clone,append

DOCTYPE html> Insert title here 1번 영역을 복사해서 3번 영역에 추가 2번 영역을 복사해서 4번 영역에 추가 3,4번 영역 지우기 1번 박스 2번 박스 3번 박스 4번 박스 $("#btn1").click(function() { //box1 아래의 모든 img태그 복사 var no1=$("#box1").find("img").clone(); //3번 영역에 추가 $("#box3").append(no1); }); $("#btn2").click(function() { //box1 아래의 모든 img태그 복사 var no2=$("#box2").find("img").clone(); //3번 영역에 추가 $("#box4").append(no2); }); //3번..remove $("#btn..

JQuery 2021.10.01

211001_list,select,contains

DOCTYPE html> Insert title here 오늘의 쇼핑 리스트 운동화 레깅스 양말 져지 안심스테이크 오늘의 메뉴 선택 초밥 스테이크 떡볶이 김치찌개 //ol 아래에 있는 모든 li 중 첫번째 li //$("ol li:first").css("background-color", "yellow"); //각 ol의 첫번째 li만 선택..child $("ol li:first-child").css("background-color", "yellow"); //전체항목에서 '스테이크'를 찾아서 글자크기 1.5배..contains $("li:contains(스테이크)").css("font-size", "1.5em"); //li의 홀수의 css변경..odd홀수, even짝수 $("li:odd").css("bor..

JQuery 2021.10.01