diff --git a/bootstrap.css b/bootstrap.css index 6411413ff7..c39a12264f 100644 --- a/bootstrap.css +++ b/bootstrap.css @@ -6,7 +6,7 @@ * http://www.apache.org/licenses/LICENSE-2.0 * * Designed and built with all the love in the world @twitter by @mdo and @fat. - * Date: Mon Dec 12 09:51:27 PST 2011 + * Date: Tue Dec 20 19:08:51 PST 2011 */ html, body { margin: 0; diff --git a/docs/assets/js/application.js b/docs/assets/js/application.js index 74024caa1d..dd759bf8b2 100644 --- a/docs/assets/js/application.js +++ b/docs/assets/js/application.js @@ -37,7 +37,7 @@ $(function(){ // POSITION STATIC TWIPSIES // ======================== - $(window).bind( 'load resize', function () { + $(window).on('load resize', function () { $(".twipsies a").each(function () { $(this) .twipsy({ diff --git a/docs/javascript.html b/docs/javascript.html index 964d2f7aaf..45a7a2fe8a 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -93,7 +93,7 @@ ================================================== -->

Javascript for Bootstrap

-

Bring Bootstrap's components to life with 12 custom, flexible jQuery plugins. +

Bring Bootstrap's components to life — now with 12 custom jQuery plugins.

@@ -121,36 +121,40 @@ - bootstrap-modal.js - Our Modal plugin is a super slim take on the traditional modal js plugin! We took special care to include only the bare functionality that we require at twitter. + bootstrap-transition.js + The transition plugin is required for adding animation to other bootstrap plugins. Include this plugin (only once) when sliding in modals or fading out alerts. - bootstrap-alert.js - The alert plugin is a super tiny class for adding close functionality to alerts. + bootstrap-modal.js + Our Modal plugin is a super slim take on the traditional modal js plugin! We took special care to include only the bare functionality that we require here at twitter. bootstrap-dropdown.js - This plugin is for adding dropdown interaction to the bootstrap navbar or tabbed navigations. + This plugin is for adding generic dropdown interactions to things like navigation top bars and tabs. bootstrap-scrollspy.js - The ScrollSpy plugin is for adding an auto updating nav based on scroll position to the bootstrap navbar. + The ScrollSpy plugin is for automatically updating nav targets based on scroll position. bootstrap-tab.js - This plugin adds quick, dynamic tab and pill functionality for cycling through local content. - + This plugin adds quick, dynamic tab and pill functionality for transitioning through local content. bootstrap-twipsy.js - Based on the excellent jQuery.tipsy plugin written by Jason Frame; twipsy is an updated version, which doesn't rely on images, uses css3 for animations, and data-attributes for local title storage! + Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; twipsy is an updated version, which doesn't rely on images, uses css3 for animations, data-attributes for local title storage, and now jquery 1.7's new event api! bootstrap-popover.js The popover plugin provides a simple interface for adding popovers to your application. It extends the boostrap-twipsy.js plugin, so be sure to grab that file as well when including popovers in your project! + + + bootstrap-alert.js + The alert plugin is a tiny class for adding close functionality to alerts. + bootstrap-button.js - This plugin offers additional functionality for managing button state. + This plugin offers additional functionality for managing button state in single buttons and button sets. bootstrap-collapse.js @@ -161,7 +165,6 @@

Is javascript necessary?

Nope! Bootstrap is designed first and foremost to be a CSS library. This javascript provides a basic interactive layer on top of the included styles.

However, for those who do need javascript, we've provided the plugins above to help you understand how to integrate Bootstrap with javascript and to give you a quick, lightweight option for the basic functionality right away.

-

For more information and to see some live demos, please refer to our plugin documentation page.

@@ -265,7 +268,7 @@ $('#myModal').modal({
-$('#myModal').bind('hidden', function () {
+$('#myModal').on('hidden', function () {
   // do something ...
 })

Demo

@@ -301,7 +304,7 @@ $('#myModal').bind('hidden', function () {
-

This plugin is for adding dropdown interaction to the Bootstrap navbar or tabbed navigations.

+

This plugin is for adding generic dropdown interactions to things like navigation top bars and tabs.

Download
@@ -375,7 +378,7 @@ $('#myModal').bind('hidden', function () {
-

This plugin is for adding the scrollspy (auto updating nav) interaction to the bootstrap navbar.

+

The ScrollSpy plugin is for automatically updating nav targets based on scroll position.

Download
@@ -449,7 +452,7 @@ $('#myModal').bind('hidden', function () {
-

This plugin adds quick, dynamic tab and pill functionality.

+

This plugin adds quick, dynamic tab and pill functionality for transitioning through local content.

Download
@@ -510,7 +513,7 @@ $('#myModal').bind('hidden', function () {
-$('a[data-toggle="tab"]').bind('shown', function (e) {
+$('a[data-toggle="tab"]').on('shown', function (e) {
   e.target // activated tab
   e.relatedTarget // previous tab
 })
@@ -529,22 +532,22 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {
-
+

Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

-
+

Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.

-
+

Banksy do proident, brooklyn photo booth delectus sunt artisan sed organic exercitation eiusmod four loko. Quis tattooed iphone esse aliqua. Master cleanse vero fixie mcsweeney's. Ethical portland aute, irony food truck pitchfork lomo eu anim. Aesthetic blog DIY, ethical beard leggings tofu consequat whatever cardigan nostrud. Helvetica you probably haven't heard of them carles, marfa veniam occaecat lomo before they sold out in shoreditch scenester sustainable thundercats. Consectetur tofu craft beer, mollit brunch fap echo park pitchfork mustache dolor.

-
+

Sunt qui biodiesel mollit officia, fanny pack put a bird on it thundercats seitan squid ad wolf bicycle rights blog. Et aute readymade farm-to-table carles 8-bit, nesciunt nulla etsy adipisicing organic ea. Master cleanse mollit high life, next level Austin nesciunt american apparel twee mustache adipisicing reprehenderit hoodie portland irony. Aliqua tofu quinoa +1 commodo eiusmod. High life williamsburg cupidatat twee homo leggings. Four loko vinyl DIY consectetur nisi, marfa retro keffiyeh vegan. Fanny pack viral retro consectetur gentrify fap.

-
-

Based on the excellent jQuery.tipsy plugin written by Jason Frame; twipsy is an updated version, which doesn't rely on images, uses css3 for animations, and data-attributes for title storage!

+

Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; twipsy is an updated version, which doesn't rely on images, uses css3 for animations, data-attributes for local title storage, and now jquery 1.7's new event api!

Download
@@ -591,16 +594,16 @@ $('a[data-toggle="tab"]').bind('shown', function (e) { how to position the tooltip - above | below | left | right - live - boolean + selector + string false - use event delegation instead of individual event handlers + If a selector is provided, twipsy objects will be delegated to the specified targets. - offset - number - 0 - pixel offset of tooltip from target element + title + string | function + '' + default title value if `title` tag isn't present trigger @@ -622,7 +625,8 @@ $('a[data-toggle="tab"]').bind('shown', function (e) {

Notice Individual twipsy instance options can alternatively be specified through the use of data attributes.

Markup

- For performance reasons, the Twipsy and Popover data-apis are opt in. If you would like to use them just set the live flag to true, however we recommend you know what you are doing if you do that. :) +

+ For performance reasons, the Twipsy and Popover data-apis are opt in. If you would like to use them just specify a selector option.

Methods

$().twipsy(options)

Attaches a twipsy handler to an element collection.

@@ -673,12 +677,6 @@ $('a[data-toggle="tab"]').bind('shown', function (e) { true apply a css fade transition to the tooltip - - delay - number | object - 0 - delay before showing/hiding the tooltip (ms) - placement string @@ -686,16 +684,10 @@ $('a[data-toggle="tab"]').bind('shown', function (e) { how to position the popover - above | below | left | right - live - boolean + selector + string false - use event delegation instead of individual event handlers - - - offset - number - 0 - pixel offset of tooltip from target element + if a selector is provided, twipsy objects will be delegated to the specified targets trigger @@ -703,12 +695,34 @@ $('a[data-toggle="tab"]').bind('shown', function (e) { 'hover' how tooltip is triggered - hover | focus | manual + + title + string | function + '' + default title value if `title` attribute isn't present + + + content + string | function + '' + default content value if `data-content` attribute isn't present + + + delay + number | object + 0 + +

delay showing/hiding the popover (ms)

+

If a number is supplied, delay is applied to both hide/show

+

Object structure is: delay: { show: 500, hide: 100 }

+ +

Notice Individual popover instance options can alternatively be specified through the use of data attributes.

Markup

- For performance reasons, the Twipsy and Popover data-apis are opt in. If you would like to use them just set the live flag to true, however we recommend you know what you are doing if you do that. :) + For performance reasons, the Twipsy and Popover data-apis are opt in. If you would like to use them just specify a the selector option.

Methods

$().popover(options)

@@ -969,7 +983,7 @@ $('#myCollapsible').collapse({
-$('#myCollapsible').bind('hidden', function () {
+$('#myCollapsible').on('hidden', function () {
   // do something ...
 })

Demo

diff --git a/js/README.md b/js/README.md index 107dd15281..061509fd3a 100644 --- a/js/README.md +++ b/js/README.md @@ -9,11 +9,11 @@ We believe you should be able to use all plugins provided by Bootstrap purely th We acknowledge that this isn't always the most performant and sometimes it may be desirable to turn this functionality off altogether. Therefore, as of 2.0 we provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this: - $('body').unbind('.data-api') + $('body').off('.data-api') To target a specific plugin, just include the plugins name as a namespace along with the data-api namespace like this: - $('body').unbind('.alert.data-api') + $('body').off('.alert.data-api') --- diff --git a/js/bootstrap-alert.js b/js/bootstrap-alert.js index db9116f761..af15cbd7be 100644 --- a/js/bootstrap-alert.js +++ b/js/bootstrap-alert.js @@ -46,7 +46,7 @@ } $.support.transition && $element.hasClass('fade') ? - $element.bind($.support.transition.end, removeElement) : + $element.on($.support.transition.end, removeElement) : removeElement() } diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index 38f4f51a29..f2624ec1c1 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -96,7 +96,7 @@ function hideWithTransition() { var that = this , timeout = setTimeout(function () { - that.$element.unbind($.support.transition.end) + that.$element.off($.support.transition.end) hideModal.call(that) }, 500) @@ -156,11 +156,11 @@ function escape() { var that = this if (this.isShown && this.options.keyboard) { - $(document).bind('keyup.dismiss.modal', function ( e ) { + $(document).on('keyup.dismiss.modal', function ( e ) { e.which == 27 && that.hide() }) } else if (!this.isShown) { - $(document).unbind('keyup.dismiss.modal') + $(document).off('keyup.dismiss.modal') } } diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js index a0495ce699..53edfc8c9d 100644 --- a/js/bootstrap-popover.js +++ b/js/bootstrap-popover.js @@ -63,8 +63,7 @@ , tip: function() { if (!this.$tip) { - this.$tip = $('
') - .html(this.options.template) + this.$tip = $(this.options.template) } return this.$tip } @@ -90,7 +89,7 @@ $.fn.popover.defaults = $.extend({} , $.fn.twipsy.defaults, { placement: 'right' , content: '' - , template: '

' + , template: '

' }) }( window.jQuery ) \ No newline at end of file diff --git a/js/bootstrap-scrollspy.js b/js/bootstrap-scrollspy.js index 3c271793c0..041cfcb454 100644 --- a/js/bootstrap-scrollspy.js +++ b/js/bootstrap-scrollspy.js @@ -27,7 +27,7 @@ function ScrollSpy( element ) { var process = $.proxy(this.process, this) - this.$scrollElement = $(element).bind('scroll.scroll.data-api', process) + this.$scrollElement = $(element).on('scroll.scroll.data-api', process) this.selector = (this.$scrollElement.attr('data-target') || this.$scrollElement.attr('href') || '') + ' .nav li > a' diff --git a/js/bootstrap-tab.js b/js/bootstrap-tab.js index e0a92816d4..2f147c59d8 100644 --- a/js/bootstrap-tab.js +++ b/js/bootstrap-tab.js @@ -52,26 +52,45 @@ $href = $(href) this.activate($this.parent('li'), $ul) - this.activate($href, $href.parent()) - - $this.trigger({ - type: 'shown' - , relatedTarget: previous + this.activate($href, $href.parent(), function () { + $this.trigger({ + type: 'shown' + , relatedTarget: previous + }) }) } - , activate: function ( element, container ) { - container - .find('> .active') - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') + , activate: function ( element, container, callback) { + var $active = container.find('> .active') + , transition = callback + && $.support.transition + && $active.hasClass('fade') - element.addClass('active') + function next() { + $active + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') - if ( element.parent('.dropdown-menu') ) { - element.closest('li.dropdown').addClass('active') + element.addClass('active') + + if (transition) { + element[0].offsetWidth // reflow for transition + element.addClass('in') + } + + if ( element.parent('.dropdown-menu') ) { + element.closest('li.dropdown').addClass('active') + } + + callback && callback() } + + transition ? + $active.one($.support.transition.end, next) : + next() + + $active.removeClass('in') } } diff --git a/js/bootstrap-twipsy.js b/js/bootstrap-twipsy.js index ee9a415fdb..ab744b7c5a 100644 --- a/js/bootstrap-twipsy.js +++ b/js/bootstrap-twipsy.js @@ -167,7 +167,7 @@ } $.support.transition && this.$tip.hasClass('fade') ? - $tip.bind( $.support.transition.end, removeElement) : + $tip.on($.support.transition.end, removeElement) : removeElement() } @@ -196,7 +196,7 @@ } , tip: function () { - return this.$tip = this.$tip || $('
').html(this.options.template) + return this.$tip = this.$tip || $(this.options.template) } , validate: function () { @@ -256,7 +256,7 @@ , placement: 'above' , trigger: 'hover' , title: '' - , template: '
' + , template: '
' } }( window.jQuery ) \ No newline at end of file