Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 如何捕捉按下ESC键关闭引导模式_Twitter Bootstrap_Modal Dialog_Angular Ui - Fatal编程技术网

Twitter bootstrap 如何捕捉按下ESC键关闭引导模式

Twitter bootstrap 如何捕捉按下ESC键关闭引导模式,twitter-bootstrap,modal-dialog,angular-ui,Twitter Bootstrap,Modal Dialog,Angular Ui,我有一个引导模式,我用它来改变缩略图的大小。我在引导模式上有一个保存和取消按钮。如果我点击取消按钮,我的缩略图将恢复到以前的大小。我希望通过点击ESC或在模式外单击来实现相同的行为。但是,我无法捕获这些事件。在Bootstrap3中,您可以使用 $('#my-modal').on('hidden.bs.modal', function () { window.alert('event fired!'); }); 谢谢@Jorge,我完全相信这会奏效。但是,我无法创建一个div class=

我有一个引导模式,我用它来改变缩略图的大小。我在引导模式上有一个保存和取消按钮。如果我点击取消按钮,我的缩略图将恢复到以前的大小。我希望通过点击ESC或在模式外单击来实现相同的行为。但是,我无法捕获这些事件。

在Bootstrap3中,您可以使用

$('#my-modal').on('hidden.bs.modal', function () {
  window.alert('event fired!');
});

谢谢@Jorge,我完全相信这会奏效。但是,我无法创建一个div class=modal来分配模态id。虽然“出现”了,但它似乎是隐藏的。只要我删除class=modal并只保留单独的modal页眉、modal正文和modal页脚。。模态实际显示。但是我需要modal类的top div来分配id以使用hidden.bs.modal。首先,如何创建modal。请参阅文档:[link]()数据目标=“myModal”是您的模式ID,因此我的问题是,我在该页面上没有启动模式的按钮来使用数据目标。我从元素指令上的“图标”启动模态。所以模态是从不同的位置发射的。我正在使用angular
{Icon:“resources/icons/music236”,标题:“Preferences”,Separate:true,OnClick:$scope.openPreferences}
$scope.openPreferences=function(){$modal.open({动画:false,templateUrl:'pages/preferences.html',控制器:'userpreferencesController',背景:'static',键盘:'false'}。结果;}
那么我希望这有帮助