$('#someDiv').hover
(function(){
(this).css({'background-color': 'black'});
},
function(){
(this).css({'background-color': 'red'});
}
);
Run Code Online (Sandbox Code Playgroud)
每次我鼠标悬停(或退出)时div,Chrome控制台都会让我回复标题中的错误.我认为div对象有一个css()方法,我觉得这种情况真的很混乱.
代替 (this).css({...});
你需要$(this).css({...});使用jQuery.
如果将jQuery重新映射到其他内容$,请使用
jQuery(this).css({...});