mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-21 04:41:36 +02:00
allow the use of data attributes to define popover options
This commit is contained in:
@@ -555,6 +555,8 @@ $('#.tabs').bind('change', function (e) {
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</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>
|
<h3>Methods</h3>
|
||||||
<h4>$().twipsy(options)</h4>
|
<h4>$().twipsy(options)</h4>
|
||||||
<p>Attaches a twipsy handler to an element collection.</p>
|
<p>Attaches a twipsy handler to an element collection.</p>
|
||||||
@@ -669,7 +671,7 @@ $('#.tabs').bind('change', function (e) {
|
|||||||
<td>content</td>
|
<td>content</td>
|
||||||
<td>string, function</td>
|
<td>string, function</td>
|
||||||
<td>'data-content'</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>
|
||||||
<tr>
|
<tr>
|
||||||
<td>trigger</td>
|
<td>trigger</td>
|
||||||
@@ -679,6 +681,8 @@ $('#.tabs').bind('change', function (e) {
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</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>
|
<h3>Methods</h3>
|
||||||
<h4>$().popover(options)</h4>
|
<h4>$().popover(options)</h4>
|
||||||
<p>Initializes popovers for an element collection.</p>
|
<p>Initializes popovers for an element collection.</p>
|
||||||
|
4
js/bootstrap-popover.js
vendored
4
js/bootstrap-popover.js
vendored
@@ -47,7 +47,7 @@
|
|||||||
, o = this.options
|
, o = this.options
|
||||||
|
|
||||||
if (typeof this.options.content == 'string') {
|
if (typeof this.options.content == 'string') {
|
||||||
content = $e.attr(o.content)
|
content = this.options.content
|
||||||
} else if (typeof this.options.content == 'function') {
|
} else if (typeof this.options.content == 'function') {
|
||||||
content = this.options.content.call(this.$element[0])
|
content = this.options.content.call(this.$element[0])
|
||||||
}
|
}
|
||||||
@@ -74,6 +74,6 @@
|
|||||||
return this
|
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 );
|
}( window.jQuery || window.ender );
|
2
js/bootstrap-twipsy.js
vendored
2
js/bootstrap-twipsy.js
vendored
@@ -299,7 +299,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$.fn.twipsy.elementOptions = function(ele, options) {
|
$.fn.twipsy.elementOptions = function(ele, options) {
|
||||||
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options
|
return $.extend({}, options, $(ele).data())
|
||||||
}
|
}
|
||||||
|
|
||||||
}( window.jQuery || window.ender );
|
}( window.jQuery || window.ender );
|
Reference in New Issue
Block a user