/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function mouse_overs (hover_item, css_property, hover_value, orig_value) { hover_item = $(hover_item); var new_obj = {}; new_obj[css_property] = hover_value; var orig_obj = {}; orig_obj[css_property] = orig_value; if (hover_item.length > 0) { hover_item.hover( function () { $(this).css(new_obj); }, function () { $(this).css(orig_obj); }); } } $(function(){ mouse_overs('button.link', 'background-position', '0 -43px', '0 0'); });