Skip to content

Commit

Permalink
Merge branch 'master' of github.com:twbs/bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo committed Jul 24, 2014
2 parents 6dde491 + 463fe47 commit abbb4d6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
20 changes: 10 additions & 10 deletions docs/_includes/js/affix.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ <h3>Positioning via CSS</h3>
<p>Here's how the affix plugin works:</p>
<ol>
<li>To start, the plugin adds <code>.affix-top</code> to indicate the element is in its top-most position. At this point no CSS positioning is required.</li>
<li>Scrolling past the element you want affixed should trigger the actual affixing. This is where <code>.affix</code> replaces <code>.affix-top</code> and sets <code>position: fixed;</code> (provided by Bootstrap's code CSS).</li>
<li>If a bottom offset is defined, scrolling past that should replace <code>.affix</code> with <code>.affix-bottom</code>. Since offsets are optional, setting one requires you to set the appropriate CSS. In this case, add <code>position: absolute;</code> when necessary. The plugin uses the data attribute or JavaScript option to determine where to position the element from there.</li>
<li>Scrolling past the element you want affixed should trigger the actual affixing. This is where <code>.affix</code> replaces <code>.affix-top</code> and sets <code>position: fixed;</code> (provided by Bootstrap's CSS).</li>
<li>If a bottom offset is defined, scrolling past it should replace <code>.affix</code> with <code>.affix-bottom</code>. Since offsets are optional, setting one requires you to set the appropriate CSS. In this case, add <code>position: absolute;</code> when necessary. The plugin uses the data attribute or JavaScript option to determine where to position the element from there.</li>
</ol>
<p>Follow the above steps to set your CSS for either of the usage options below.</p>

Expand All @@ -31,14 +31,14 @@ <h3>Via data attributes</h3>
<h3>Via JavaScript</h3>
<p>Call the affix plugin via JavaScript:</p>
{% highlight js %}
$('#my-affix').affix({
offset: {
top: 100
, bottom: function () {
return (this.bottom = $('.footer').outerHeight(true))
}
$('#myAffix').affix({
offset: {
top: 100,
bottom: function () {
return (this.bottom = $('.footer').outerHeight(true))
}
})
}
})
{% endhighlight %}


Expand Down Expand Up @@ -75,7 +75,7 @@ <h3>Options</h3>


<h3>Events</h3>
<p>Bootstrap's affix class exposes a few events for hooking into affix functionality.</p>
<p>Bootstrap's affix plugin exposes a few events for hooking into affix functionality.</p>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
Expand Down
24 changes: 13 additions & 11 deletions docs/_includes/js/alerts.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ <h1 id="alerts" class="page-header">Alert messages <small>alert.js</small></h1>

<h2 id="alerts-examples">Example alerts</h2>
<p>Add dismiss functionality to all alert messages with this plugin.</p>
<div class="bs-example">
<div class="bs-example bs-example-standalone">
<div class="alert alert-warning alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.
</div>
</div><!-- /example -->

<div class="bs-example">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4>Oh snap! You got an error!</h4>
Expand All @@ -24,21 +22,25 @@ <h4>Oh snap! You got an error!</h4>


<h2 id="alerts-usage">Usage</h2>
<p>Enable dismissal of an alert via JavaScript:</p>
{% highlight js %}$(".alert").alert(){% endhighlight %}

<h3>Markup</h3>
<p>Just add <code>data-dismiss="alert"</code> to your close button to automatically give an alert close functionality.</p>
{% highlight html %}<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>{% endhighlight %}

{% highlight html %}
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
{% endhighlight %}

<p>To have your alerts use animation when closing, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p>

<h3>Methods</h3>

<h4>$().alert()</h4>
<p>Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the <code>.fade</code> and <code>.in</code> class already applied to them.</p>
<p>Makes an alert listen for click events on descendant elements which have the <code>data-dismiss="alert"</code> attribute. (Not necessary when using the data-api's auto-initialization.)</p>

<h4>.alert('close')</h4>
<h4>$().alert('close')</h4>
<p>Closes an alert.</p>
{% highlight js %}$(".alert").alert('close'){% endhighlight %}


<h3>Events</h3>
Expand All @@ -64,7 +66,7 @@ <h3>Events</h3>
</table>
</div><!-- /.table-responsive -->
{% highlight js %}
$('#my-alert').on('closed.bs.alert', function () {
$('#myAlert').on('closed.bs.alert', function () {
// do something…
})
{% endhighlight %}
Expand Down
3 changes: 3 additions & 0 deletions docs/assets/css/src/docs.css
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,9 @@ h1[id] {
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.bs-example-standalone {
border-radius: 4px;
}
}

/* Undo width of container */
Expand Down

0 comments on commit abbb4d6

Please sign in to comment.