1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-25 21:09:06 +02:00

update more readme changes - introduce target specificty convention to more plugins

This commit is contained in:
Jacob Thornton
2011-12-20 23:28:48 -08:00
parent c4364285e4
commit f72a94ae28
12 changed files with 76 additions and 51 deletions

12
js/bootstrap-modal.js vendored
View File

@@ -175,17 +175,16 @@
, options = typeof option == 'object' && option
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
else if (data.options.show) data.show()
else data.show()
})
}
$.fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}
$.fn.modal.Modal = Modal
$.fn.modal.Constructor = Modal
/* MODAL DATA-API
@@ -194,10 +193,11 @@
$(function () {
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
var $this = $(this)
, target = $this.attr('data-target') || $this.attr('href')
, option = $(target).data('modal') ? 'toggle' : $this.data()
, $target = $($this.attr('data-target') || $this.attr('href'))
, option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
e.preventDefault()
$(target).modal(option)
$target.modal(option)
})
})