jquerycss怎么添加box-shadow

jquerycss怎么添加box-shadow,第1张

例如

<a href=javascript:" id="color">我是颜色</a>我要给这个添加box-shadow效果

两种方法实现,一个原生js的和一个jquery

原生方法实现

function $(id){

    return document.getElementById(id)

}

color.style.boxShadow= "10px 10px 5px #f00"//添加阴影

jquery 实现

$("#color")..css('box-shadow',"10px 10px 5px #f00")//添加阴影

     <!DOCTYPE html>  

    <html>  

    <head>  

    <meta content="text/html charset=gb2312" http-equiv="Content-Type">  

    <title>文哥讨厌IE</title>  

    <script type="text/javascript" src="jquery.js"></script>    

    <style type="text/css">  

    .box-shadow{  

        box-shadow: 10px 10px 10px 10px red  

        

    }  

      

    .obj{  

        border-radius:100px

        width:100px  

        height:100px  

        margin:50px auto  

        background:#eee      

    }  

    </style>  

    </head>  

      

    <body>  

        <div class="obj" ></div>  

        <script type="text/javascript">  

            $(document).ready(function(){  

                $(".obj").mouseover(function(){

                    $(".obj").addClass("box-shadow")

                })

                $(".obj").mouseout(function(){

                    $(".obj").removeClass("box-shadow")

                })

          })  

        </script>  

      

    </body>  

    </html>

x.style.box-shadow=x.style.boxShadow

x.style.border-radius=x.style.borderRadius

依次类推


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11459341.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-16
下一篇2023-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存