Skip to content

Commit

Permalink
Adding changeDisplayValue to popup implementation, which allows you t…
Browse files Browse the repository at this point in the history
…o toggle display from block to none.
  • Loading branch information
anutron committed Aug 14, 2012
1 parent 71b78f2 commit e2d1dd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Docs/UI/Bootstrap.Popup.md
Expand Up @@ -27,6 +27,7 @@ Bootstrap.Popover Method: constructor
* closeOnEsc - (*boolean*) When `true` (the default) the popup is closed when the user hits escape. * closeOnEsc - (*boolean*) When `true` (the default) the popup is closed when the user hits escape.
* mask - (*boolean*) When `true` (the default) a mask is placed below the popup element. * mask - (*boolean*) When `true` (the default) a mask is placed below the popup element.
* animate - (*boolean*) When `true` (the default) the mask and the window are displayed with a transition effect. * animate - (*boolean*) When `true` (the default) the mask and the window are displayed with a transition effect.
* changeDisplayValue (*boolean*) When `true` (the default), the popup element's `display` property is toggled between `block` and `none` on the end of the transitions.


### Events ### Events


Expand Down
5 changes: 4 additions & 1 deletion Source/UI/Bootstrap.Popup.js
Expand Up @@ -41,7 +41,8 @@ Bootstrap.Popup = new Class({
closeOnClickOut: true, closeOnClickOut: true,
closeOnEsc: true, closeOnEsc: true,
mask: true, mask: true,
animate: true animate: true,
changeDisplayValue: true
}, },


initialize: function(element, options){ initialize: function(element, options){
Expand Down Expand Up @@ -85,6 +86,7 @@ Bootstrap.Popup = new Class({
this._makeMask(); this._makeMask();
this._mask.inject(document.body); this._mask.inject(document.body);
this.animating = true; this.animating = true;
if (this.options.changeDisplayValue) this.element.show();
if (this._checkAnimate()){ if (this._checkAnimate()){
this.element.offsetWidth; // force reflow this.element.offsetWidth; // force reflow
this.element.addClass('in'); this.element.addClass('in');
Expand All @@ -109,6 +111,7 @@ Bootstrap.Popup = new Class({
this.fireEvent('show', this.element); this.fireEvent('show', this.element);
} else { } else {
this.fireEvent('hide', this.element); this.fireEvent('hide', this.element);
if (this.options.changeDisplayValue) this.element.hide();
if (!this.options.persist){ if (!this.options.persist){
this.destroy(); this.destroy();
} else { } else {
Expand Down

0 comments on commit e2d1dd4

Please sign in to comment.