如何在“Bootstrap:collapse plugin”之后触发JavaScript函数过渡完成了 [英] How to trigger a JavaScript function after "Bootstrap: collapse plugin" transition is done

查看:74
本文介绍了如何在“Bootstrap:collapse plugin”之后触发JavaScript函数过渡完成了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Bootstrap之后重新调整 iframe 高度: collapse 插件转换已完成。 Click事件不起作用,因为转换尚未完成,JavaScript获取错误的高度信息。有什么想法可以解决这个问题吗?

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 finished yet, JavaScript gets the wrong height information. Any Idea to solve this issue?

推荐答案

你需要处理崩溃插件上的隐藏事件。

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

来自文档


hidden - 当用户隐藏了崩溃元素
时将触发此事件(将等待css转换完成)​​。

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…
})

正如@Francesc在Bootstrap 3.0评论中指出的那样,我们必须使用

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

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

这篇关于如何在“Bootstrap:collapse plugin”之后触发JavaScript函数过渡完成了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆