这篇文章主要介绍了使用mouse事件实现简单的鼠标经过特效的方法,需要的朋友可以参考下
代码超级简单,这里就不多BB了,直接奉上
代码如下:
<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>
Document
</title>
<style type="text/css">
body,ul,li{margin:0;
padding
:0;
list-style
:none}
ul li{width:100px; height:100px; border:1px solid #f00; float:left; margin:50px 10px;
background-color
:#ffffff;}
ul li.current{border:1px solid #dfdfdf; background-color:#ff0000;}
</style>
<script type="text/
javascript
" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
</head>
<body>
<h1>鼠标经过下面的块</h1>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>
<script type="text/javascript">
$("ul li").mouseover(function()
{
$(this).addClass("current");
}).mouseout(function()
{
$(this).removeClass("current");
});
</script>非常简单的代码,小伙伴们参考下,自由扩展,希望大家能够喜欢。
以上就是JS mouse事件实现简单的鼠标经过特效的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号