diff options
| author | Jacob Thornton <[email protected]> | 2011-10-29 19:27:02 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2011-10-29 19:27:02 -0700 |
| commit | 640fd15464306238de99a3391888a95156e27995 (patch) | |
| tree | 83c14ea7a106bf3ee26a7777c18c33ce01b92ce0 | |
| parent | ea50e8aeeed6616a61a7e44d28fe60ced327be0c (diff) | |
| download | bootstrap-640fd15464306238de99a3391888a95156e27995.tar.xz bootstrap-640fd15464306238de99a3391888a95156e27995.zip | |
allow the use of data attributes to define popover options
| -rw-r--r-- | docs/javascript.html | 6 | ||||
| -rw-r--r-- | js/bootstrap-popover.js | 4 | ||||
| -rw-r--r-- | js/bootstrap-twipsy.js | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/docs/javascript.html b/docs/javascript.html index 47edf2b75..3aac2a82f 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -555,6 +555,8 @@ $('#.tabs').bind('change', function (e) { </tr> </tbody> </table> + <p><span class="label notice">Notice</span> Individual twipsy instance options can alternatively be specified through the use of data attributes.</code></p> + <pre class="prettyprint linenums"><a href="#" data-placement="below" rel='twipsy' title='Some title text'>text</a></pre> <h3>Methods</h3> <h4>$().twipsy(options)</h4> <p>Attaches a twipsy handler to an element collection.</p> @@ -669,7 +671,7 @@ $('#.tabs').bind('change', function (e) { <td>content</td> <td>string, function</td> <td>'data-content'</td> - <td>attribute or method for retrieving content text</td> + <td>a string or method for retrieving content text. if none are provided, content will be sourced from a data-content attribute.</td> </tr> <tr> <td>trigger</td> @@ -679,6 +681,8 @@ $('#.tabs').bind('change', function (e) { </tr> </tbody> </table> + <p><span class="label notice">Notice</span> Individual popover instance options can alternatively be specified through the use of data attributes.</code></p> + <pre class="prettyprint linenums"><a data-placement="below" href="#" class="btn danger" rel="popover">text</a></pre> <h3>Methods</h3> <h4>$().popover(options)</h4> <p>Initializes popovers for an element collection.</p> diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js index a8a1d8e7b..e8f4ce096 100644 --- a/js/bootstrap-popover.js +++ b/js/bootstrap-popover.js @@ -47,7 +47,7 @@ , o = this.options if (typeof this.options.content == 'string') { - content = $e.attr(o.content) + content = this.options.content } else if (typeof this.options.content == 'function') { content = this.options.content.call(this.$element[0]) } @@ -74,6 +74,6 @@ return this } - $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { content: 'data-content', placement: 'right'}) + $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { placement: 'right'}) }( window.jQuery || window.ender );
\ No newline at end of file diff --git a/js/bootstrap-twipsy.js b/js/bootstrap-twipsy.js index ad2938a1a..f0e5b1b90 100644 --- a/js/bootstrap-twipsy.js +++ b/js/bootstrap-twipsy.js @@ -299,7 +299,7 @@ } $.fn.twipsy.elementOptions = function(ele, options) { - return $.metadata ? $.extend({}, options, $(ele).metadata()) : options + return $.extend({}, options, $(ele).data()) } }( window.jQuery || window.ender );
\ No newline at end of file |
