开发者

change width of image on toggle

开发者 https://www.devze.com 2023-04-07 09:40 出处:网络
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 li

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(

0

精彩评论

暂无评论...
验证码 换一张
取 消