diff options
author | Jacob Thornton <jacobthornton@gmail.com> | 2012-06-04 08:26:54 +0400 |
---|---|---|
committer | Jacob Thornton <jacobthornton@gmail.com> | 2012-06-04 08:26:54 +0400 |
commit | 82ea5847a7188b2798c5dbb0792e53ee8f60db55 (patch) | |
tree | 8700b7499d022149951d4ded17759f6e0da69ff7 /js/bootstrap-modal.js | |
parent | 041b8bdfd32cc93c6594a0e3cb1e93e74faa2562 (diff) |
adds remote source to modal. Remote source can be specified in href or by providing a remote option #936
Diffstat (limited to 'js/bootstrap-modal.js')
-rw-r--r-- | js/bootstrap-modal.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index fb5da75c3a..9663399081 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -30,6 +30,7 @@ this.options = options this.$element = $(content) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) + this.options.remote && this.$element.find('.modal-body').load(this.options.remote) } Modal.prototype = { @@ -215,9 +216,10 @@ $(function () { $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) { - var $this = $(this), href - , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data()) + var $this = $(this) + , href = $this.attr('href') + , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 + , option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) e.preventDefault() $target.modal(option) |