728x90 jQuery 제이쿼리15 [객체] 함수를 활용한 속성 부여 $(document).ready(function (){ $('.text_box').attr('height', function(index){ // 단계적으로 크기 적용 return (index + 1) * 100; // 인덱스 0인 .text_box == (0+1) * 100 => height : 100px }) }) $(function(){ $('img').attr({ width : function (index) { return (index + 1) * 100; }, height : 100 }); }); 2021. 5. 12. [객체] addClass() : 인덱스 순서대로 클래스 추가 $(document).ready(function (){ $('li').addClass(function(index){ // 함수를 매개변수로 입력 return 'class' + index; }) }) 2021. 5. 11. [객체] Setter와 Getter 이해 // 1. Setter : jQuery 객체를 리턴 // 1-방법A : (문자열, 문자열) $("h1").css('color','red'); // 1-방법B-ㄱ : (객체) $('h1').css({ 'color':'orange', 'background-color':'black', 'text-alian':'center' }); // 1-방법B-ㄴ : (객체) > '-' 대신 '대문자'로 바꿔서 식별자로 사용할 것 $('article').css({ width :'130px', height : '133px', border : 'blue', backgroundColor:'black', textAlian:'center' }); // 1-방법C-ㄱ : 함수로 값을 입력하는 방법 $('p').css('color', .. 2021. 5. 11. 이전 1 2 3 4 다음 728x90