From dee57462e2805421a0fe0d786229446bbaef677b Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 14 Aug 2012 21:06:08 -0700 Subject: get affix actually working and update docs --- docs/templates/pages/javascript.mustache | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'docs/templates/pages/javascript.mustache') diff --git a/docs/templates/pages/javascript.mustache b/docs/templates/pages/javascript.mustache index 296ccef81..1109dbaf1 100644 --- a/docs/templates/pages/javascript.mustache +++ b/docs/templates/pages/javascript.mustache @@ -13,7 +13,7 @@ ================================================== -->
-
-

{{_i}}Example{{/i}}

{{_i}}The subnavigation on the left is a live demo of the affix plugin.{{/i}}

@@ -1535,13 +1534,13 @@ $('.carousel').carousel({

{{_i}}Usage{{/i}}

{{_i}}Via data attributes{{/i}}

-

{{_i}}To easily add affix behavior to any element, just add data-spy="affix" to the element you want to spy on. When the affix offsets are satisified, an .affix class is added to the element. {{/i}}

+

{{_i}}To easily add affix behavior to any element, just add data-spy="affix" to the element you want to spy on. Then use offsets to define when to toggle the pinning of an element on and off.{{/i}}

-
<div data-spy="affix">...</body>
+
<div data-spy="affix" data-offset-top="200">...</body>
{{_i}}Heads up!{{/i}} - {{_i}}It's up to you to maintain the dimensions of an element when toggling between relative and fixed positions. To see how this is done, refer to this pages subnavigation.{{/i}} + {{_i}}It's up to you to manage the position of a pinned element. This is done by styling affix, affix-top, and affix-bottom.{{/i}}

{{_i}}Via JavaScript{{/i}}

@@ -1549,16 +1548,15 @@ $('.carousel').carousel({
$('#navbar').affix()

{{_i}}Methods{{/i}}

-

.scrollspy('refresh')

-

{{_i}}When using affix in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh method like so:{{/i}}

+

.affix('refresh')

+

{{_i}}When using affix in conjunction with adding or removing of elements from the DOM, you'll want to call the refresh method:{{/i}}

 $('[data-spy="affix"]').each(function () {
   $(this).affix('refresh')
 });
 
-

{{_i}}Options{{/i}}

-

{{_i}}Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-offset-y="".{{/i}}

+

{{_i}}Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-offset-top="200".{{/i}}

@@ -1571,9 +1569,9 @@ $('[data-spy="affix"]').each(function () { - + - +
{{_i}}offset{{/i}}{{_i}}number | object{{/i}}{{_i}}number | function | object{{/i}} {{_i}}10{{/i}}{{_i}}Pixels to offset from screen when calculating position of scroll. If a single number is provide, the offset will be applied in both top and left directions. To listen for a single direction, or multiple unique offsets, just provided an object offset: { x: 10 }.{{/i}}{{_i}}Pixels to offset from screen when calculating position of scroll. If a single number is provide, the offset will be applied in both top and left directions. To listen for a single direction, or multiple unique offsets, just provided an object offset: { x: 10 }. Use a function when you need to dynamically provide an offset (useful for some responsive designs).{{/i}}
-- cgit v1.2.3