so i have a function for handling elements with a hover, however i want to be able to pass in the css styles as an argument. i have tried different variations, but this is currently my code (just the necessary portion)…
function load_hovers(mouseOverCss){
$('.hover').hover(function(){
$(this).animate({
eval(mouseOverCss)
}, 500, function() {
});
and i call load_hovers("backgroundColor: 'red'");
this returns an error invalid object initializer $(this).animate({. without using eval, the error is missing : after property id {eval(mouseOverCss)}\n.
any suggestions?
got it.
and then just
thanks Phil for getting me on the path of not just sending a string pre-formatted for animate()!