开发者

jQuery - Toggle Image Expand/Close

I have a dashboard pretty much a rip off of BBC.com which allows you to minimise and and expand the widget by clicking on a butt开发者_如何学Con.

When you've clicked on it, the image changes to indicate the widget is expanded or minimized.

Does anyone know how to do this in jQuery?


Take a look here

Example:

$('.target').toggle();

If you want something to slide up and down you can try this:

   var visible = true;

    $("button").click(function () {
          $("p").slideToggle("slow", function () {
            visible = !visible;
            if (visible)
            {
              $('icon').attr('src', 'url_to_downimage.jpg');
            }
            else
            {
              $('icon').attr('src', 'url_to_expandimage.jpg');
            }
    });
  });
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜