メソッドチェーンの書き方
--->test3.js
$(function(){
$("#btn").on('click',function(){
$('#d1').css('opacity',0.5);
$('#d2').css('width','50px').css('height','50px')//メソッドチェーンの書き方
});
});
まとめて書くやり方
$(function(){
$("#btn").on('click',function(){
$('#d1').css('opacity',0.5);
$('#d2').css({
'width':'50px', //ここの末尾のカンマを忘れないように!!
'height':'50px'
});
});
});
オブジェクトはメソッドとプロパティから出来ている
a.hoverについて(自習)
>ちなみにCSSには順番も関係してくるので、上から順に「link→visited→hover→active」で書かなければ期待したようには動きません。