Twitter Bootstrap: Call a js function when a dropdown is closed

前端 未结 6 1385
执念已碎
执念已碎 2020-12-13 23:59

Is there an event that I can tie into that is fired when a bootstrap dropdown is closed or toggled?

6条回答
  •  长情又很酷
    2020-12-14 00:27

    From twitter bootstrap official page:

    $('#myDropdown').on('hide.bs.dropdown', function () {
      // do something…
    });
    

    hide.bs.dropdown is one of 4 events described here.

    Update (13-Apr-16)

    These events also work same in Bootstrap 4. Bootstrap v4 Documentation.

提交回复
热议问题