程序笔记   发布时间:2022-07-21  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery鼠标点击事件,改变背景色大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery-3.6.0.js"></script>
    <style>
        .paging li{
            width:60px;
            height:40px;
            line-height:40px;
            float: left;
            text-align:center;
            list-style: none;
        }
    </style>
    <script>
       $(function(){
        //    初始化div 绑定事件
        var initDiv=function(){
            $(".paging li").css("BACkground","");
            $(".paging li").mouseover(function(){
                $("this").css("BACkground","green")            
        })
            $(".paging li").mouseout(function(){
                 $("this").css("BACkground","")  
            })
       };
       initDiv();
        $(".paging li").click(function(){
            initDiv();
            // 当前被点击的div改变背景色
            $(this).css("BACkground","green");
            // 取消当前div的mouseout和mouseover事件
            $(this).unbind("mouseout")
            $(this).unbind("mouseover")
        })
    })
       
    </script>
</head>
<body>
    <ul class="paging">
        <li><<</li>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>>></li>
    </ul>
</body>
</html>

 

大佬总结

以上是大佬教程为你收集整理的jquery鼠标点击事件,改变背景色全部内容,希望文章能够帮你解决jquery鼠标点击事件,改变背景色所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。