"sprites arrow-d"라는 이미지가 부모 요소 ".learn-more"에 있습니다. learn-more를 클릭하면 화살표 -u가 arrow-u로 바뀌고 그 반대도 마찬가지입니다. 이것을 쓰는 가장 좋은 방법은 무엇입니까?jquery로 이미지 토글
$('.learn-more').click(function() {
if ($('.arrow-d').is('arrow-d'))
{
$('#hero').animate({
'height':'400'
}, 700);
$('.arrow-d').removeClass('arrow-d').addClass('arrow-u');
}
else
{
$('.arrow-u').removeClass('arrow-u').addClass('arrow-d');
}
});
HTML :
<div class="learn-more">
<span>LEARN MORE ABOUT</span>
<i class="sprites arrow-d"></i>
</div>
좋아하고, 무엇을 : 이런 식으로 뭔가? 어떻게하면 다시 "80px"라고 말 할 수 있습니까? – Josh
@Josh 클릭하면 80px를 추가하고 다시 클릭하면 80px를 제거하겠습니까? –