Skip to content

Instantly share code, notes, and snippets.

@matsumotius
Created September 2, 2012 23:34
Show Gist options
  • Save matsumotius/3605642 to your computer and use it in GitHub Desktop.
Save matsumotius/3605642 to your computer and use it in GitHub Desktop.
set focus color
(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