JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/dot-luv/jquery-ui.css">
<div>Test - Uses Live</div>
<br />
<div>Test - Uses Bind</div>
JavaScript
jQuery.fn.sb_animateMenuItem = function() {
var mousehoverColor = '#0089F7';
var duration = 250;
var method = this.selector ? jQuery.fn.live : jQuery.fn.bind;
method.apply(this, ['mouseover', function() {
if(!jQuery.data(this, 'oColor'))
jQuery.data(this, 'oColor', jQuery(this).css('background-color'));
jQuery(this).stop(true).animate({ backgroundColor:mousehoverColor }, duration);
}]);
method.apply(this, ['mouseout', function() {
jQuery(this).animate({ backgroundColor:jQuery.data(this, 'oColor') }, duration);
}]);
return this.css('cursor', 'pointer');
};
$('div:first').sb_animateMenuItem();
$($('div')[1]).sb_animateMenuItem();