Skip to content

Commit

Permalink
WIP transition fixes for detection
Browse files Browse the repository at this point in the history
  • Loading branch information
jlukic committed Nov 30, 2014
1 parent 5de9b72 commit 53584d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
3 changes: 3 additions & 0 deletions src/definitions/modules/dropdown.js
Expand Up @@ -1108,6 +1108,9 @@ $.fn.dropdown = function(parameters) {
hide: function(callback, $subMenu) {
var
$currentMenu = $subMenu || $menu,
duration = ($subMenu)
? (settings.duration * 0.9)
: settings.duration,
start = ($subMenu)
? function() {}
: function() {
Expand Down
40 changes: 19 additions & 21 deletions src/definitions/modules/transition.js
Expand Up @@ -145,7 +145,7 @@ $.fn.transition = function() {

}
}
if(module.can.animate()) {
if( module.can.animate() ) {
module.set.animating(settings.animation);
}
else {
Expand Down Expand Up @@ -499,29 +499,21 @@ $.fn.transition = function() {
},

can: {
animate: function() {
if($module.css(settings.animation) !== 'none') {
module.debug('CSS definition found', $module.css(settings.animation));
return true;
}
else {
module.debug('Unable to find css definition', $module.attr('class'));
return false;
}
},
transition: function(forced) {
var
elementClass = $module.attr('class'),
tagName = $module.prop('tagName'),
animation = settings.animation,
transitionExists = module.get.transitionExists(settings.animation),
transitionExists = module.get.transitionExists(animation),
$clone,
currentAnimation,
inAnimation,
animationExists,
directionExists,
displayType
;
if( transitionExists === undefined || forced) {
console.log($.fn.transition.exists);
console.log(transitionExists, forced);
module.verbose('Determining whether animation exists');
$clone = $('<' + tagName + ' />').addClass( elementClass ).insertAfter($module);
currentAnimation = $clone
Expand All @@ -545,21 +537,27 @@ $.fn.transition = function() {
.css('display')
;
module.verbose('Determining final display state', displayType);
$clone.remove();
if(currentAnimation != inAnimation) {
module.debug('Transition exists for animation', animation);
animationExists = true;
module.debug('Direction exists for animation', animation);
directionExists = true;
}
else if(currentAnimation == 'none' || !currentAnimation) {
module.debug('No animation defined in css', animation);
return;
}
else {
module.debug('Static animation found', animation, displayType);
animationExists = false;
directionExists = false;
}
$clone.remove();
module.save.displayType(displayType);
if(transitionExists === undefined) {
module.save.transitionExists(animation, animationExists);
}
module.save.transitionExists(animation, directionExists);
}
return transitionExists || animationExists;
return transitionExists || directionExists;
},
animate: function() {
// can transition does not return a value if animation does not exist
return (module.can.transition() !== undefined);
}
},

Expand Down

0 comments on commit 53584d8

Please sign in to comment.