Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
907b3b28
Commit
907b3b28
authored
10 years ago
by
Mark Otto
Browse files
Options
Download
Plain Diff
Merge pull request #13907 from twbs/fat-12145
add "focus" to focused btns with button plugin
parents
719cde1a
6b6476fc
4 merge requests
!28721
Hot test
,
!16605
Test pull please ignore
,
!22103
test
,
!25326
Adjust examples
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/button.js
+22
-6
js/button.js
with
22 additions
and
6 deletions
+22
-6
js/button.js
+
22
-
6
View file @
907b3b28
...
...
@@ -97,14 +97,30 @@
}
// FOCUS SHIM (FOR BUTTON GROUPS)
// ==============================
function
getBtnTarget
(
target
)
{
var
$target
=
$
(
target
)
return
$target
.
hasClass
(
'
btn
'
)
?
$target
:
$target
.
parent
(
'
.btn
'
)
}
// BUTTON DATA-API
// ===============
$
(
document
).
on
(
'
click.bs.button.data-api
'
,
'
[data-toggle^="button"]
'
,
function
(
e
)
{
var
$btn
=
$
(
e
.
target
)
if
(
!
$btn
.
hasClass
(
'
btn
'
))
$btn
=
$btn
.
closest
(
'
.btn
'
)
Plugin
.
call
(
$btn
,
'
toggle
'
)
e
.
preventDefault
()
})
$
(
document
)
.
on
(
'
click.bs.button.data-api
'
,
'
[data-toggle^="button"]
'
,
function
(
e
)
{
var
$btn
=
$
(
e
.
target
)
if
(
!
$btn
.
hasClass
(
'
btn
'
))
$btn
=
$btn
.
closest
(
'
.btn
'
)
Plugin
.
call
(
$btn
,
'
toggle
'
)
e
.
preventDefault
()
})
.
on
(
'
focus.bs.button.data-api
'
,
'
[data-toggle^="button"]
'
,
function
(
e
)
{
getBtnTarget
(
e
.
target
).
addClass
(
'
focus
'
)
})
.
on
(
'
blur.bs.button.data-api
'
,
'
[data-toggle^="button"]
'
,
function
(
e
)
{
getBtnTarget
(
e
.
target
).
removeClass
(
'
focus
'
)
})
}(
jQuery
);
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets