Twitter bootstrap 3.0 icon change on collapse

前端 未结 10 1213
长发绾君心
长发绾君心 2020-12-04 19:41

This is about Bootstrap 3.0. I would like the icon/glyphicon to change on collapse. I.e, from a closed folder to an open one.

I have searched far and wide, and have

10条回答
  •  無奈伤痛
    2020-12-04 20:19

    For bootstrap collapse plus and minus sign button.

    HTML

    Others

    Others are

    Javascript

    $(document).ready(function () {
         $('.collapse')
             .on('shown.bs.collapse', function() {
                 $(this)
                     .parent()
                     .find(".glyphicon-plus")
                     .removeClass("glyphicon-plus")
                     .addClass("glyphicon-minus");
                 })
             .on('hidden.bs.collapse', function() {
                 $(this)
                     .parent()
                     .find(".glyphicon-minus")
                     .removeClass("glyphicon-minus")
                     .addClass("glyphicon-plus");
                 });
             });
    

提交回复
热议问题