国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

查看大圖功能代碼jquery版

2024-05-06 15:54:06
字體:
來源:轉載
供稿:網友
查看大圖的效果想必大家在瀏覽網頁時都有看過吧,其實實現起來很簡單的,下面有個不錯的示例,喜歡的朋友可以參考下

復制代碼 代碼如下:


/*查看大圖*/
var screenheight = $(window).height();
var screenwidth = $(window).width();
var loadCSS = function(){
var screenwidth = $(window).width();
var screenheight = $(window).height();
$("div.lookBigPicture").css({"left":screenwidth*0.2,"top":screenheight*0.15+$(document).scrollTop(),
"width":screenwidth*0.6,"height":screenheight*0.7});
$("img.bigImg").css({"max-width":(screenwidth*0.6 - 30),"max-height":screenheight*0.7-40});
$("img.bigImg").load(function(){
$("img.bigImg").css("top",(screenheight*0.7 - 30 - $("img.bigImg").height())*0.5 + 30);
});
$("img.bigImg").css("top",(screenheight*0.7 - 30 - $("img.bigImg").height())*0.5 + 30);
$.log("$(document).height():"+$(document).height());
};
$("a#bigPic").click(function(){
$.log("screenheight:"+screenheight+"screenwidth:"+screenwidth);
str = $("img[img-size]").attr("src");
$("body").append("<div></div>");//灰色底層
$("body").append("<div><span><a z-index='20001' target='_blank' href='"+str+"'>查看原圖</a></span><a href='javascript:;' title='關閉'>×</a><img src='"+str+"'/></div>");
$("div.grey").css( "height",$(document).height());
loadCSS();
$("body").css({overflow:"hidden"}); //禁用滾動條
});
$("body").delegate("div.grey,a.bigpicclose","click",function(){
$("body").css({overflow:"visible"}); //恢復滾動條
$("div.lookBigPicture").remove();
$("div.grey").remove();
});
//當瀏覽器窗口大小改變時
$(window).resize(function () {
loadCSS();
});


復制代碼 代碼如下:


/***遮罩層****/
.grey {
background: #000;
display: block;
z-index: 1000;
width: 100%;
position: absolute;
filter: alpha(opacity : 50);
opacity: 0.5;
top: 0;
left: 0;
top: 0;
}

.lookBigPicture {
border: #000 solid 1px;
position: absolute;
z-index: 2000;
text-align: center;
background: black;
}

.bigImg {
margin-left: auto;
margin-right: auto;
position: relative;
}

.bigpicclose {
position: absolute;
width: 36px;
height: 36px;
font-size: 0;
z-index: 20001;
top: -18px;
right: -18px;
background:
url("http://img.t.sinajs.cn/t5/style/images/layer/multipic_ico.png?id=20131018174500")
0 0 no-repeat;
}

.lookbigicn {
display: inline-block;
width: 12px;
height: 12px;
background:
url("http://img.t.sinajs.cn/t5/style/images/common/icon.png?id=1383027536816")
-175px -25px no-repeat;
vertical-align: -2px;
margin-left: 20px;
}

.W_ico12 {
display: inline-block;
width: 12px;
height: 12px;
background:
url("http://img.t.sinajs.cn/t5/style/images/common/icon.png?id=1383027536816")
-175px 0px no-repeat;
vertical-align: -2px;
}

.protoPic {
position: absolute;
display: inline-block;
height: 30px;
top: 10px;
right: 50px;
overflow: hidden;
cursor: pointer;
color: #F8F8F8;
text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
}


復制代碼 代碼如下:


<p pic-choice>
<em></em><a href="javascript:;">收起</a>
<em></em><a href="javascript:;">查看大圖</a>
</p>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 古浪县| 康定县| 扶余县| 佳木斯市| 应城市| 上饶市| 田东县| 紫金县| 二连浩特市| 华亭县| 兴宁市| 武鸣县| 方城县| 宜都市| 遂溪县| 栖霞市| 扬中市| 漳平市| 砀山县| 台北县| 卓尼县| 许昌市| 北辰区| 石狮市| 南郑县| 巴东县| 德江县| 漾濞| 新民市| 鹿邑县| 大石桥市| 米易县| 西安市| 固原市| 高台县| 贡嘎县| 和龙市| 龙川县| 波密县| 拉萨市| 青神县|