How to trigger a JavaScript function after “Bootstrap: collapse plugin” transition is done

后端 未结 3 682
失恋的感觉
失恋的感觉 2021-02-19 06:18

I\'m trying to re-size iframe height after Bootstrap: collapse plugin transition is finished. Click event doesn\'t work because the transition is not f

3条回答
  •  悲&欢浪女
    2021-02-19 07:06

    You need to handle the hidden event on the collapse plugin.

    From Docs

    hidden - This event is fired when a collapse element has been hidden from the user (will wait for css transitions to complete).

    $('#myCollapsible').on('hidden', function () {
      // do something…
    })
    

    As pointed by @Francesc in the comment for Bootstrap 3.0 we have to use

    $('#myCollapsible').on('hidden.bs.collapse', function () {
      // do something…
    })
    

提交回复
热议问题