首页 > 其他 > 详细

焦点图片效果

时间:2015-06-18 21:57:28      阅读:198      评论:0      收藏:0      [点我收藏+]

鼠标移到一个元素上,其他元素变黑,显得此元素很亮,鼠标移出,都变成明亮效果

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jquery效果</title>
<style type="text/css">
    #box{
        width:800px;
        height: 148px;
        background:black;
    }
    #box img{
        float: left;
    }
</style>
<script type="text/javascript" src="./js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
$(function(){
    $(‘#box img‘).mouseover(function(){//鼠标移入事件
        $(this).fadeTo(0,1);//0时间透明度为1
        $(this).siblings(‘img‘).fadeTo(0,0.7);//让移入元素的兄弟元素透明度变为0.7,背景颜色为黑色,所以看起来会变暗
    })
    $(‘#box img‘).mouseout(function(){//鼠标移出
        $(this).fadeTo(0,1);//让所有的透明度为1
    })
})
    
</script>
</head>
<body>
 <div id="box">
     <img src="img2/1.jpg" >
     <img src="img2/2.jpg" >
     <img src="img2/3.jpg" >
     <img src="img2/4.jpg" >
 </div>   
</body>
</html>

 

焦点图片效果

原文:http://www.cnblogs.com/lzzhuany/p/4586966.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!