change width of image on toggle
I need to change the width of an image with in a toggled div. The problem is that I have multiple toggles on the page and that all the开发者_高级运维 image width's change when I click on the toggle link and not just the on one within the div that I want
$('.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;
});
});
$('.guideImage img', this).animate({
Possibly?
Hard to tell without all the code, but I think this might work.
Change
$('.guideImage img').animate(
to
$(this).prev('.guidebox').find('.guideImage img').animate(
精彩评论