继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

jquery轻量级鼠标悬停半透明遮罩效果,一看就懂哦

慕粉0415482673
关注TA
已关注
手记 297
粉丝 64
获赞 367

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery打造鼠标悬停图片时的半透明遮罩效果</title>
<style>
*{margin:0;padding:0;}
li{list-style:none;}
.box{width:800px;height:400px;margin:50px auto;overflow:hidden;}
.box ul li{width:200px;height:200px;float:left;position:relative;overflow:hidden;}
.box ul li .dask{width:170px;height:180px;padding:20px 0 0 30px;background:#000;opacity:0.8;position:absolute;top:-200px;left:0;}
.box ul li .dask p{color:#fff;}
.box ul li .dask a{color:green;text-decoration:none}
</style>
<script type="text/javascript" src="/ajaxjs/jquery-1.9.1.min.js"></script>
<script>
$(function () {
    $(".box ul li").hover(
        function () {
            $(this).find(".dask").stop().delay(50).animate({"top":0,opacity:0.8},300)
         },
        function () {
            $(this).find(".dask").stop().animate({"top":-200,opacity:0},300)
        }

    )
})
</script>
</head>
<body>
<div class="box">
<ul>
    <li>
        <a href="www.nftx8.com"><img src="/jscss/demoimg/wall_s1.jpg" width="200" height="200" alt="" /></a>
        <div class="dask">
            <p>荃银高科</p>
            <p>天穿</p>
            <a href="/">您想不到的美景</a>
        </div>
    </li>
    <li>
        <a href="www.nftx8.com"><img src="/jscss/demoimg/wall_s2.jpg" width="200" height="200" alt="" /></a>
        <div class="dask">
            <p>落日</p>
            <p>天错时</p>
            <a href="/">自然美</a>
        </div>
    </li>
</ul>
</div>
</body>
</html>


将img里面src换成你本地的图片名字就可以了



来源www.nftx8.com 

打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP