Browse Source

Fixes #23 issue with queued animations in dropdown and modal

pull/19/merge
jlukic 11 years ago
parent
commit
303498459f
3 changed files with 11 additions and 12 deletions
  1. 2
      node/src/documents/modules/dimmer.html
  2. 9
      src/modules/dimmer.js
  3. 12
      src/modules/dropdown.js

2
node/src/documents/modules/dimmer.html

@ -19,7 +19,7 @@ type : 'UI Module'
</div> </div>
</div> </div>
<div class="segment">
<div class="ui vertical segment">
<div class="container"> <div class="container">
<h1 class="ui dividing header"> <h1 class="ui dividing header">
Dimmer Dimmer

9
src/modules/dimmer.js

@ -191,7 +191,7 @@ $.fn.dimmer = function(parameters) {
return $dimmer.hasClass(className.active); return $dimmer.hasClass(className.active);
}, },
animating: function() { animating: function() {
return ( $dimmer.hasClass(className.show) || $dimmer.hasClass(className.hide) || $dimmer.is(':animated') );
return ( $dimmer.is(':animated') || $dimmer.hasClass(className.transition) );
}, },
dimmer: function() { dimmer: function() {
return $module.is(selector.dimmer); return $module.is(selector.dimmer);
@ -259,7 +259,7 @@ $.fn.dimmer = function(parameters) {
show: function(callback) { show: function(callback) {
module.debug('Showing dimmer', $dimmer); module.debug('Showing dimmer', $dimmer);
if( (!module.is.active() || module.is.animating() ) && module.is.enabled() ) {
if( !(module.is.active() || module.is.animating() ) && module.is.enabled() ) {
module.animate.show(callback); module.animate.show(callback);
$.proxy(settings.onShow, element)(); $.proxy(settings.onShow, element)();
$.proxy(settings.onChange, element)(); $.proxy(settings.onChange, element)();
@ -270,7 +270,7 @@ $.fn.dimmer = function(parameters) {
}, },
hide: function(callback) { hide: function(callback) {
if( module.is.active() || module.is.animating() ) {
if( module.is.active() && !module.is.animating() ) {
module.debug('Hiding dimmer', $dimmer); module.debug('Hiding dimmer', $dimmer);
module.animate.hide(callback); module.animate.hide(callback);
$.proxy(settings.onHide, element)(); $.proxy(settings.onHide, element)();
@ -510,14 +510,13 @@ $.fn.dimmer.settings = {
className : { className : {
active : 'active', active : 'active',
animating : 'animating',
dimmable : 'ui dimmable', dimmable : 'ui dimmable',
dimmed : 'dimmed', dimmed : 'dimmed',
disabled : 'disabled', disabled : 'disabled',
pageDimmer : 'page', pageDimmer : 'page',
hide : 'hide', hide : 'hide',
show : 'show', show : 'show',
transition : 'transition hidden visible'
transition : 'transition'
} }
}; };

12
src/modules/dropdown.js

@ -316,14 +316,14 @@ $.fn.dropdown = function(parameters) {
is: { is: {
visible: function($subMenu) { visible: function($subMenu) {
return ($subMenu) return ($subMenu)
? $subMenu.is(':visible')
: $menu.is(':visible')
? $subMenu.is(':animated, :visible')
: $menu.is(':animated, :visible')
; ;
}, },
hidden: function($subMenu) { hidden: function($subMenu) {
return ($subMenu) return ($subMenu)
? $subMenu.is(':not(:visible)')
: $menu.is(':not(:visible)')
? $subMenu.is(':not(:animated, :visible)')
: $menu.is(':not(:animated, :visible)')
; ;
} }
}, },
@ -434,7 +434,7 @@ $.fn.dropdown = function(parameters) {
show: function() { show: function() {
dropdown.debug('Checking if dropdown can show'); dropdown.debug('Checking if dropdown can show');
if( !dropdown.is.visible() ) {
if( dropdown.is.hidden() ) {
dropdown.hideOthers(); dropdown.hideOthers();
dropdown.set.active(); dropdown.set.active();
dropdown.animate.show(dropdown.set.visible); dropdown.animate.show(dropdown.set.visible);
@ -446,7 +446,7 @@ $.fn.dropdown = function(parameters) {
}, },
hide: function() { hide: function() {
if( !dropdown.is.hidden() ) {
if( dropdown.is.visible() ) {
dropdown.debug('Hiding dropdown'); dropdown.debug('Hiding dropdown');
if( dropdown.can.click() ) { if( dropdown.can.click() ) {
dropdown.unbind.intent(); dropdown.unbind.intent();

Loading…
Cancel
Save