我是靠谱客的博主 兴奋犀牛,这篇文章主要介绍使用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>

非常简单的代码,小伙伴们参考下,自由扩展,希望大家能够喜欢。

最后

以上就是兴奋犀牛最近收集整理的关于使用mouse事件实现简单的鼠标经过特效的全部内容,更多相关使用mouse事件实现简单内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(154)

评论列表共有 0 条评论

立即
投稿
返回
顶部