From 5f65df9e2db7c16c3c64930331a467e18501e20c Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 10 Sep 2011 14:04:22 -0700 Subject: [PATCH] add some more events to alerts and modal and update docs --- docs/javascript.html | 44 ++++++++++++++++++++++++++++++++++++++---- js/bootstrap-alerts.js | 9 +++++---- js/bootstrap-modal.js | 8 +++++--- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/docs/javascript.html b/docs/javascript.html index 8a4636bb3d..47cd34414b 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -85,9 +85,9 @@ $('#modal-content').modal({ closeOnEscape: true })

Events

-

Trigger events to make things happen!

+

Bootstraps modal class makes use of custom events. You can use trigger to make things happen manually or bind to listen for things happening.

modal:toggle

-

Toggle the modal open state.

+

Toggle the modal open state.

$('#modal-content').trigger('modal:toggle')

modal:show

Opens the modal.

@@ -95,8 +95,21 @@ $('#modal-content').modal({

modal:hide

Closes the modal.

$('#modal-content').trigger('modal:hide')
+

modal:shown

+

Fired when the modal has been made visible.

+
+$('#modal-content')
+  .bind('modal:shown', function () {
+    // do something here...
+  })
+

modal:hidden

+

Fired when the modal has become hidden

+
+$('#modal-content')
+  .bind('modal:hidden', function () {
+    $(this).remove() // cleanup jQuery plugin data on hide
+  })

Demo

-