diff options
| author | Mark Otto <[email protected]> | 2014-07-07 00:59:51 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2014-07-07 00:59:51 -0700 |
| commit | a0d8d56593388790fba2b20acf117fb954e0766a (patch) | |
| tree | d76ab06189ee1d5076005aea15cd914b44ceea67 /docs/dist/js/bootstrap.js | |
| parent | d5e2262782a12af00639c3a7914580556d9b3a2b (diff) | |
| download | bootstrap-a0d8d56593388790fba2b20acf117fb954e0766a.tar.xz bootstrap-a0d8d56593388790fba2b20acf117fb954e0766a.zip | |
grunt
Diffstat (limited to 'docs/dist/js/bootstrap.js')
| -rw-r--r-- | docs/dist/js/bootstrap.js | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/docs/dist/js/bootstrap.js b/docs/dist/js/bootstrap.js index 42e6edc48..b6cb4f8d0 100644 --- a/docs/dist/js/bootstrap.js +++ b/docs/dist/js/bootstrap.js @@ -258,15 +258,31 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re } + // 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); |
