Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
e8b66a96
Commit
e8b66a96
authored
Oct 29, 2011
by
Jacob Thornton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
star work on bootstrap-buttons.js
parent
9a30b8c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
0 deletions
+100
-0
docs/javascript.html
docs/javascript.html
+50
-0
js/bootstrap-buttons.js
js/bootstrap-buttons.js
+50
-0
No files found.
docs/javascript.html
View file @
e8b66a96
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
<script
src=
"../js/bootstrap-dropdown.js"
></script>
<script
src=
"../js/bootstrap-dropdown.js"
></script>
<script
src=
"../js/bootstrap-scrollspy.js"
></script>
<script
src=
"../js/bootstrap-scrollspy.js"
></script>
<script
src=
"../js/bootstrap-tabs.js"
></script>
<script
src=
"../js/bootstrap-tabs.js"
></script>
<script
src=
"../js/bootstrap-buttons.js"
></script>
<!-- Le styles -->
<!-- Le styles -->
<link
href=
"../bootstrap.css"
rel=
"stylesheet"
>
<link
href=
"../bootstrap.css"
rel=
"stylesheet"
>
...
@@ -48,6 +49,7 @@
...
@@ -48,6 +49,7 @@
<li><a
href=
"#modal"
>
Modals
</a></li>
<li><a
href=
"#modal"
>
Modals
</a></li>
<li><a
href=
"#dropdown"
>
Dropdown
</a></li>
<li><a
href=
"#dropdown"
>
Dropdown
</a></li>
<li><a
href=
"#scrollspy"
>
ScrollSpy
</a></li>
<li><a
href=
"#scrollspy"
>
ScrollSpy
</a></li>
<li><a
href=
"#buttons"
>
Buttons
</a></li>
<li><a
href=
"#tabs"
>
Tabs
</a></li>
<li><a
href=
"#tabs"
>
Tabs
</a></li>
<li><a
href=
"#twipsy"
>
Twipsy
</a></li>
<li><a
href=
"#twipsy"
>
Twipsy
</a></li>
<li><a
href=
"#popover"
>
Popover
</a></li>
<li><a
href=
"#popover"
>
Popover
</a></li>
...
@@ -312,6 +314,54 @@ $('#my-modal').bind('hidden', function () {
...
@@ -312,6 +314,54 @@ $('#my-modal').bind('hidden', function () {
</div>
</div>
</section>
</section>
<!-- Tabs
================================================== -->
<section
id=
"buttons"
>
<div
class=
"page-header"
>
<h1>
Buttons
<small>
bootstrap-buttons.js
</small></h1>
</div>
<div
class=
"row"
>
<div
class=
"span4 columns"
>
<p>
This plugin offers additional functionality for managing button state.
</p>
<a
href=
"../js/bootstrap-buttons.js"
target=
"_blank"
class=
"btn primary"
>
Download
</a>
</div>
<div
class=
"span12 columns"
>
<h3>
Using bootstrap-buttons.js
</h3>
<pre
class=
"prettyprint linenums"
>
$('.tabs').button()
</pre>
<h3>
Markup
</h3>
<p>
You can leverage bootstraps button toggle helper without writing any javascript by using the
<code>
data-toggle
</code>
attribute.
</p>
<pre
class=
"prettyprint linenums"
>
<
button class="btn" data-toggle="toggle"
>
...
<
/button
>
</pre>
<h3>
Methods
</h3>
<h4>
$().button('loading')
</h4>
<p>
Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element using the data attribute
<code>
data-loading-text
</code>
.
</p>
<pre
class=
"prettyprint linenums"
>
<
button class="btn" data-loading-text="loading stuff..."
>
...
<
/button
>
</pre>
<h4>
$().button('reset')
</h4>
<p>
Resets button state - swaps text to original text.
</p>
<h4>
$().button(string)
</h4>
<p>
Resets button state - swaps text to any data defined text state.
</p>
<pre
class=
"prettyprint linenums"
>
<
button class="btn" data-complete-text="finished!"
>
...
<
/button
>
<
script
>
$('.btn').button('complete')
<
/scrip
>
</pre>
<h3>
Demo
</h3>
<button
id=
"fat-btn"
class=
"btn danger"
>
Click me
</button>
<script>
$
(
function
()
{
var
btn
=
$
(
'
#fat-btn
'
).
click
(
function
()
{
btn
.
button
(
'
loading
'
)
setTimeout
(
function
()
{
btn
.
button
(
'
reset
'
)
},
3000
)
})
})
</script>
</div>
</div>
</section>
<!-- Tabs
<!-- Tabs
================================================== -->
================================================== -->
...
...
js/bootstrap-buttons.js
0 → 100644
View file @
e8b66a96
/* ============================================================
* bootstrap-dropdown.js v1.3.0
* http://twitter.github.com/bootstrap/javascript.html#dropdown
* ============================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */
!
function
(
$
){
"
use strict
"
function
setState
(
el
,
state
)
{
var
d
=
'
disabled
'
,
$el
=
$
(
el
)
,
data
=
$el
.
data
()
state
=
state
+
'
Text
'
data
.
resetText
||
$el
.
data
(
'
resetText
'
,
$el
.
html
())
$el
.
html
(
data
[
state
]
||
$
.
fn
.
button
.
defaults
[
state
]
)
state
==
'
loadingText
'
?
$el
.
addClass
(
d
).
attr
(
d
,
d
)
:
$el
.
removeClass
(
d
).
removeAttr
(
d
)
}
$
.
fn
.
button
=
function
(
state
)
{
var
d
=
'
disabled
'
return
this
.
each
(
function
()
{
state
&&
setState
(
this
,
state
)
})
}
$
.
fn
.
button
.
defaults
=
{
loadingText
:
'
loading...
'
}
}(
window
.
jQuery
||
window
.
ender
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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