Minimize / Maximize div's with jQuery

前端 未结 2 1105
既然无缘
既然无缘 2021-01-04 13:10

I basically want to minimise some div\'s . Instead of using \"-\" and \"+\", I want to use some symbols (from font-awesome) to minimise and maximise the div\'s.

My

2条回答
  •  余生分开走
    2021-01-04 13:36

    Say you give .btn-minimize the minus icon in CSS. You also give .btn-minimize.btn-plus the plus icon. Your javascript can then look like this:

    $(".btn-minimize").click(function(){
        $(this).toggleClass('btn-plus');
        $(".widget-content").slideToggle();
    });
    

    Here's an example on JSFiddle: http://jsfiddle.net/uzmjq/

提交回复
热议问题