Permalink
Browse files

Merge pull request #115 from mboehlke/master

Optimize the `hide()` method
  • Loading branch information...
2 parents 9be0b64 + 43ec0c5 commit 07767cf56b1d55391dbe26174a4be9d840dda874 @claviska committed Jan 14, 2014
Showing with 7 additions and 12 deletions.
  1. +7 −12 jquery.minicolors.js
View
19 jquery.minicolors.js
@@ -227,19 +227,14 @@ if(jQuery) (function($) {
// Hides all dropdown panels
function hide() {
- $('.minicolors-input').each( function() {
-
- var input = $(this),
- settings = input.data('minicolors-settings'),
- minicolors = input.parent();
-
- // Don't hide inline controls
- if( settings.inline ) return;
-
+ $('.minicolors-focus').each( function() {
+
+ var minicolors = $(this),
+ input = minicolors.find('.minicolors-input'),
+ settings = input.data('minicolors-settings');
+
minicolors.find('.minicolors-panel').fadeOut(settings.hideSpeed, function() {
- if(minicolors.hasClass('minicolors-focus')) {
- if( settings.hide ) settings.hide.call(input.get(0));
- }
+ if( settings.hide ) settings.hide.call(input.get(0));
minicolors.removeClass('minicolors-focus');
});

0 comments on commit 07767cf

Please sign in to comment.