* hover로 준 결과와 같은 결과가 나옴
// $('img').bind('mouseover', function(){})
// $('img').bind('mouseout', function(){})
$('img').hover(function(){
temp = $(this).attr('src'); --> src의 속성값을 temp 변수에 저장
temp2 = $(this).attr('src2'); --> src2의 속성값을 temp2 변수에 저장
--> src의 속성값을 src2의 속성값으로 변경한다
$(this).attr('src', temp2)
}, function(){
$(this).attr('src', temp); --> src의 속성값을 변경한다
})
})
'jQuery' 카테고리의 다른 글
jQuery stopPropagation()사용하기 (0) | 2020.01.15 |
---|---|
jQuery keyup() - 글자 수 초과되는거 막기 (0) | 2020.01.14 |
jQuery hover 주기 (0) | 2020.01.14 |
jQuery toggle() 사용하기 (0) | 2020.01.13 |
jQuery prop-change주기 (0) | 2020.01.13 |
댓글