Created
September 2, 2012 23:34
-
-
Save matsumotius/3605642 to your computer and use it in GitHub Desktop.
set focus color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
$.fn.colorFocus = function(color, trigger){ | |
var defaultColor = $(this).css('background-color'); | |
var hasTrigger = (typeof trigger == 'function'); | |
$(this).mouseover(function(e){ | |
if (hasTrigger && false == trigger(this)) return; | |
$(this).css('background-color', color); | |
}); | |
$(this).mouseout(function(e){ | |
$(this).css('background-color', defaultColor); | |
}); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment