jquery实现聚光灯效果
类别:Web前端 浏览量:1715
时间:2014-7-13 jquery实现聚光灯效果
jquery实现聚光灯效果一、jquery实现聚光灯效果图
二、jquery代码
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery聚光灯插件制作jquery图片特效鼠标滑过图片当前图片高亮</title>
<meta name="description" content="jquery聚光灯插件制作jquery图片特效当鼠标滑过图片时当前图片高亮显示其余另外的图片变暗。" />
</head>
<body>
<style type="text/css">
*{margin:0;padding:0;list-style-type:none;}
a,img{border:0;}
img{vertical-align:middle}
/* lamp */
.lamp{height:366px;width:960px;position:relative;margin:0 auto;}
.lamp .sublight{position:absolute;display:block;overflow:hidden;}
.lamp .pic1{top:0;left:0;width:240px;height:366px;}
.lamp .pic2{top:0;left:240px;width:480px;height:183px;}
.lamp .pic3{top:0;left:720px;width:240px;height:183px;}
.lamp .pic4{top:183px;left:240px;width:240px;height:183px;}
.lamp .pic5{top:183px;left:480px;width:240px;height:183px;}
.lamp .pic6{top:183px;left:720px;width:240px;height:183px;}
</style>
<li class="lamp">
<a target="_blank" href="http://www.studyofnet.com/" class="sublight pic1"><img src="图片URL"/></a>
<a target="_blank" href="http://www.studyofnet.com/" class="sublight pic2"><img src="图片URL"/></a>
<a target="_blank" href="http://www.studyofnet.com/" class="sublight pic3"><img src="图片URL"/></a>
<a target="_blank" href="http://www.studyofnet.com/" class="sublight pic4"><img src="图片URL"/></a>
<a target="_blank" href="http://www.studyofnet.com/" class="sublight pic5"><img src="图片URL"/></a>
<a target="_blank" href="http://www.studyofnet.com/" class="sublight pic6"><img src="图片URL"/></a>
</li>
<script type="text/javascript" src="jquery。js"></script>
<script type="text/javascript">
// 高亮效果
var blockHighLight = (function(window, $, undefined){
var markers = [];
return function(boxCls, itemCls, sizeArr){
var box = $(boxCls);
itemCls = itemCls || "a";
box.find(itemCls).each(function(i){
var self = $(this);
var arr,w,h,marker;
if(sizeArr !== undefined){
arr = sizeArr[i].split(",");
w = arr[0];
h = arr[1];
}else{
w = self.find("img").attr("width");
h = self.find("img").attr("height");
}
marker = $('<li style="cursor:pointer;top:0;left:0;position:absolute;width:'+w+'px;height:'+h+'px;filter:alpha(opacity=0);opacity: 0;background-color:#000;"></li>');
self.append(marker);
self.mouseover(function(){
for(var i=0; i<markers.length; i++){
markers[i].show().css({"opacity":'0.2',"filter":"alpha(opacity=20)"});
}
marker.hide();
});
markers.push(marker);
});
box.mouseout(function(){
for(var i=0; i<markers.length; i++){
markers[i].css({"opacity":'0',"filter":"alpha(opacity=0)"});
}
})
标签:jquery
您可能感兴趣
- css3设置过渡效果(CSS3 media queries + jQuery实现响应式导航)
- jquery实现微信中长按识别二维码
- jquery中prop和attr的区别
- jquery隐藏动画教程(jquery插件实现鼠标隐藏)
- jquery中wrap、wrapAll、wrapInner
- jquery判断是否为数组
- jquery解析xml
- jQuery 右侧浮动导航菜单
- jquery实现在光标位置插入内容
- jquery导航栏动画(jQuery实现带展开动画的导航栏效果)
- jquery ajax的async使用
- jquery.ajax error 如何调试错误
- jquery的each的用法
- jquery中one()的用法
- jQuery判断对象是否存在
- jquery 实现对联广告
- 浙江省一个县,人口超40万,建县历史超1100年(浙江省一个县人口超40万)
- 五代十国南唐历代国君(五代十国南唐历代国君)
- 飞机引进工程师杨隆 匠人匠心,只争朝夕(飞机引进工程师杨隆)
- 三人行,她们是育人路上的 铁三角 团队(她们是育人路上的)
- 阴阳师 孟婆山兔CP不倒 新皮肤草稿 孟婆兔 让痒痒鼠点赞(阴阳师孟婆山兔CP不倒)
- 阴阳师孟婆御魂推荐 孟婆御魂搭配毕业套(阴阳师孟婆御魂推荐)