1
我需要更改切換div中的圖像的寬度。問題是,我有頁面中的所有圖像寬度的變化上,並且多個切換,當我點擊切換鏈接,不只是一個,我想更改切換寬度的圖像
$('.toggle').click(function() {
$(this).prev('.guidebox').slideToggle(400);
$('.toggle').toggleClass("active")
if ($(this).html() === 'less') {
$(this).html('more');
$('.guideImage img').animate({
width: '187px',
height: '124px'
}, 50, function() {
});
} else {
$(this).html('less');
$('.guideImage img').animate({
width: '300px',
height: '124px'
}, 50, function() {
});
}
return false;
});
});
感謝。我不得不使用.parent,因爲它在外面,但現在工作:) – kristina