首页 技术 正文
技术 2022年11月13日
0 收藏 671 点赞 4,487 浏览 2789 个字
 /*
*鍥剧墖澶у浘鏄剧ず
*/
function imgshow(){
content_div:"";//内容
bg_div:"";//背景变暗
img_div:"";//图片
prev_div:"";//上一页
next_div:"";//下一页 $(content_div).find("img").click(function(){
var img = new Image();
img.src =$(this).attr("src") ;
num=$(content_div).find("img").length;
imgcount=$(content_div).find("img").index($(this));
var src=$(content_div).find("img").eq(imgcount).attr("src");
var imgWidth=img.width;
var imgHeiht=img.height;
wh=document.documentElement.clientHeight;
ww=document.documentElement.clientWidth;
marginH=(wh-imgHeiht)/2;
marginW=(ww-imgWidth)/2;
$(img_div).css({"top":marginH,"left":marginW});
//alert(www);
$(bg_div).css({"width":ww,"height":wh});
$(bg_div).css({"display":"block"});
$(img_div).html("<img src='"+src+"'>");
$(prev_div).html("<h1><</h1>");
$(next_div).html("<h1>></h1>");
$(prev_div).css({"top":wh/2,"left":"50px"});
$(next_div).css({"top":wh/2,"right":"50px"});
//$(".big-img:after").css({"top":-h});
$(img_div).show("slow");
$(img_div).find("img").css({"max-height":wh,"max-width":ww}); })
$(prev_div).click(function(){ if(imgcount!=0){
var src=$("#content-detailed img").eq(imgcount-1).attr("src"); $(img_div).html("<img src='"+src+"'>");
var imgWidth=$(img_div).find("img").width();
var imgHeiht=$(img_div).find("img").height();
//alert(imgWidth);
wh=document.documentElement.clientHeight;
ww=document.documentElement.clientWidth;
marginH=(wh-imgHeiht)/2;
marginW=(ww-imgWidth)/2;
$(img_div).css({"top":marginH,"left":marginW});
$(img_div).find("img").css({"max-height":wh,"max-width":ww});
$(img_div).hide();
$(img_div).show("slow");
imgcount--;
}
})
$(next_div).click(function(){
if(imgcount<num-1){ var src=$("#content-detailed img").eq(imgcount+1).attr("src");
$(img_div).html("<img src='"+src+"'>");
var imgWidth=$(img_div).find("img").width();
var imgHeiht=$(img_div).find("img").height();
//alert(imgWidth);
wh=document.documentElement.clientHeight;
ww=document.documentElement.clientWidth;
marginH=(wh-imgHeiht)/2;
marginW=(ww-imgWidth)/2;
$(img_div).css({"top":marginH,"left":marginW});
$(img_div).find("img").css({"max-height":wh,"max-width":ww});
$(img_div).hide();
$(img_div).show("slow");
imgcount++;
}
})
$(bg_div).click(function(){ $(img_div).hide("slow");
$(prev_div).html("");
$(next_div).html("");
$(img_div).html("");
$(bg_div).css({"display":"none"}); }) }
css:
 div.big-img{position: fixed;z-index:; display: none;border-radius: 5px;}
div.big-img img{border-radius: 5px;}
div.prev{position: fixed;z-index:;color: #fff;cursor: pointer;text-shadow: 0 0 10px #666;}
div.next{position: fixed;z-index:;color: #fff;cursor: pointer;text-shadow: 0 0 10px #666;} #bgDiv {
z-index:;
display: block;
position: fixed;
top: 0px;
left: 0px;
right:0px;
background-color: #000;
filter:progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75);
opacity: 0.6;
}
 5     content_div:"";//内容
6 bg_div:"";//背景变暗
7 img_div:"";//图片
8 prev_div:"";//上一页
9 next_div:"";//下一页只需引用js,设置上面的div的id或者class
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,111
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,584
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,431
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,203
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,838
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,922