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
您可能感兴趣
- jquery属性选择器
- jquery五子棋javascript(原生JavaScript实现简单五子棋游戏)
- jquery ajax的async使用
- jQuery 右侧浮动导航菜单
- jquery中unbind、bind
- jquery实现标签输入功能
- jquery 淡入淡出
- jquery中wrap、wrapAll、wrapInner
- jquery获取outerhtml
- jquery如何实现倒计时
- jquery判断是否为数组
- javascript和jquery的区别详解(JavaScript与JQuery框架基础入门教程)
- jquery使用data缓存数据
- jquery操作table
- jQuery商品属性选择的实现
- Jquery中的offset()和position()的区别
- 萌娃唱《白龙马》走红,那生动的小表情,网友直呼 简直是戏精(萌娃唱白龙马走红)
- 朱鹤松被不断认可,凤凰传奇玲花喊话岳云鹏,索要老朱演出门票(朱鹤松被不断认可)
- 元宵晚会槽点多,芒果台上来就假唱,岳云鹏不说相声改评书了(元宵晚会槽点多)
- 岳云鹏跟凤凰传奇谈心,说出了人生中最重要的三个人,这才成功(岳云鹏跟凤凰传奇谈心)
- 爱情可以当饭吃吗(爱情能当饭吃吗)
- Top 3 JSHS《运动与健康科学 英文 》跻身SCI体育学期刊世界前三(Top3JSHS运动与健康科学)