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

18
js/bootstrap-alert.js vendored
View File

@@ -35,18 +35,22 @@
constructor: Alert
, close: function ( e ) {
var $element = $(this)
var $this = $(this)
, selector = $this.attr('data-target') || $this.attr('href')
, $parent = $(selector)
$element = $element.hasClass('alert-message') ? $element : $element.parent()
e && e.preventDefault()
$element.removeClass('in')
$parent.length || ($parent = $this.hasClass('alert-message') ? $this : $this.parent())
$parent.removeClass('in')
function removeElement() {
$element.remove()
$parent.remove()
}
$.support.transition && $element.hasClass('fade') ?
$element.on($.support.transition.end, removeElement) :
$.support.transition && $parent.hasClass('fade') ?
$parent.on($.support.transition.end, removeElement) :
removeElement()
}
@@ -65,7 +69,7 @@
})
}
$.fn.alert.Alert = Alert
$.fn.alert.Constructor = Alert
/* ALERT DATA-API