六:事件处理

hover(Function, Function)    当鼠标move over时触发第一个function,当鼠标move out时触发第二个function
样式:<style>.red{color:#FF0000}</style>
Html代码: <div >jQuery代码及效果


$(function(){
   $(
"#a").hover(function(){$(this).addClass("red"
);},
                            
function(){ $(this).removeClass("red"
); 
                          });
})

最终效果是当鼠标移到id为a的层上时图层增加一个red样式,离开层时移出red样式

相关文章:

  • 2021-08-20
  • 2022-12-23
  • 2021-12-23
  • 2022-02-21
  • 2021-12-23
  • 2021-08-16
  • 2022-02-09
猜你喜欢
  • 2021-09-10
  • 2021-05-21
  • 2021-09-02
  • 2022-01-22
  • 2021-05-30
相关资源
相似解决方案