第四章
实现鼠标经过字体变白吗,背景变蓝的效果,鼠标离开,恢复原来的样式。
<!DOCTYPE html><html> ?<head> ???<title>Unit.html</title> ???<style type="text/css"> ???.a{ ???????background: blue; ???????color: white; ???} ???</style> ???<script type="text/javascript" src="../js/jquery-3.3.1.js"></script> ???<script type="text/javascript"> ???????$(function(){ ???????????$("li").mouseover(function(){ ???????????????$(this).addClass("a"); ???????????}); ???????????$("li").mouseleave(function(){ ???????????????$(this).removeClass("a"); ???????????}); ???????????????????}); ???</script> ?</head> ???<body> ???新手上路: ???<ul> ???????<li>标题一</li> ???????<li>标题一</li> ???????<li>标题一</li> ???????<li>标题一</li> ???????<li>标题一</li> ???</ul> ?</body></html>
jquery练习
原文地址:https://www.cnblogs.com/excellencesy/p/8776467.html