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

add preventDefault support for all inital event types (show, close, hide, etc.) + fix small bug with scrollspy.last

This commit is contained in:
Jacob Thornton
2012-03-24 18:20:09 -07:00
parent ef5ac02b69
commit bccc2cb719
16 changed files with 128 additions and 32 deletions

10
js/bootstrap-tab.js vendored
View File

@@ -39,6 +39,7 @@
, selector = $this.attr('data-target')
, previous
, $target
, e
if (!selector) {
selector = $this.attr('href')
@@ -49,11 +50,14 @@
previous = $ul.find('.active a').last()[0]
$this.trigger({
type: 'show'
, relatedTarget: previous
e = $.Event('show', {
relatedTarget: previous
})
$this.trigger(e)
if (e.isDefaultPrevented()) return
$target = $(selector)
this.activate($this.parent('li'), $ul)