aboutsummaryrefslogtreecommitdiff
path: root/docs/assets
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2014-11-03 23:37:38 -0800
committerChris Rebert <[email protected]>2014-11-03 23:37:38 -0800
commit203912b9c500c44e3091093965fc4dc4ffeef7ff (patch)
treee8ee7bd16cafc7098856056735f4043f5ea3971c /docs/assets
parentdeab673d43b1293857f708fa7a64228c023093e1 (diff)
parent594831f4f3f3c1164812cfdd60497fe6d7438376 (diff)
downloadbootstrap-203912b9c500c44e3091093965fc4dc4ffeef7ff.tar.xz
bootstrap-203912b9c500c44e3091093965fc4dc4ffeef7ff.zip
Merge pull request #14989 from twbs/modal-relatedTarget-data-example
Add event.relatedTarget + `data-*` example to Modal docs
Diffstat (limited to 'docs/assets')
-rw-r--r--docs/assets/js/src/application.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js
index 571645e5f..c85c59dae 100644
--- a/docs/assets/js/src/application.js
+++ b/docs/assets/js/src/application.js
@@ -109,6 +109,17 @@
}, 3000)
})
+ // Modal relatedTarget demo
+ $('#exampleModal').on('show.bs.modal', function (event) {
+ var button = $(event.relatedTarget) // Button that triggered the modal
+ var recipient = button.data('whatever') // Extract info from data-* attributes
+ // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
+ // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
+ var modal = $(this)
+ modal.find('.modal-title').text('New message to ' + recipient)
+ modal.find('.modal-body input').val(recipient)
+ })
+
// Activate animated progress bar
$('.bs-docs-activate-animated-progressbar').on('click', function () {
$(this).siblings('.progress').find('.progress-bar-striped').toggleClass('active')