PageSourceSearch

https://www.jiyuwu.com/JS/imgshow.js

js jiyuwu.com collected 2026-10-08 05:00:32 UTC 2,863 bytes, 69 lines download raw bytes

1function imgShow(outerdiv, innerdiv, bigimg, _this) {
2    imgMax = 30;
3    var src = $(_this).attr("src");//获取当前点击的pimg元素中的src属性
4    $(bigimg).attr("src", src);//设置#bigimg元素的src属性
5
6    /*获取当前点击图片的真实大小,并显示弹出层及大图*/
7    $("<img/>").attr("src", src).load(function () {
8        var windowW = $(window).width();//获取当前窗口宽度
9        var windowH = $(window).height();//获取当前窗口高度
10        var realWidth = this.width;//获取图片真实宽度
11        var realHeight = this.height;//获取图片真实高度
12        var imgWidth, imgHeight;
13        var scale = 0.8;//缩放尺寸,当图片真实宽度和高度大于窗口宽度和高度时进行缩放
14
15        if (realHeight > windowH * scale) {//判断图片高度
16            imgHeight = windowH * scale;//如大于窗口高度,图片高度进行缩放
17            imgWidth = imgHeight / realHeight * realWidth;//等比例缩放宽度
18            if (imgWidth > windowW * scale) {//如宽度扔大于窗口宽度
19                imgWidth = windowW * scale;//再对宽度进行缩放
20            }
21        } else if (realWidth > windowW * scale) {//如图片高度合适,判断图片宽度
22            imgWidth = windowW * scale;//如大于窗口宽度,图片宽度进行缩放
23            imgHeight = imgWidth / realWidth * realHeight;//等比例缩放高度
24        } else {//如果图片真实高度和宽度都符合要求,高宽不变
25            imgWidth = realWidth;
26            imgHeight = realHeight;
27        }
28        $(bigimg).css("width", imgWidth);//以最终的宽度对图片缩放
29
30        var w = (windowW - imgWidth) / 2;//计算图片与窗口左边距
31        var h = (windowH - imgHeight) / 2;//计算图片与窗口上边距
32        $(innerdiv).css({ "top": h, "left": w });//设置#innerdiv的top和left属性
33        $(outerdiv).fadeIn("fast");//淡入显示#outerdiv及.pimg
34    });
35
36    $(outerdiv).click(function () {//再次点击淡出消失弹出层
37        $(this).fadeOut("fast");
38    });
39}
40
41function zoomImg(o) {
42    var zoom = parseInt(o.style.zoom, 10) || 100;
43    if (event.wheelDelta > 0) {
44        imgMax += 30;
45    } else { imgMax -= 30; }
46    zoom += imgMax;
47    if (zoom > 0) {
48        o.style.width = zoom + '%';
49        if ($(window).width() <= o.width) {
50            var divinn = $("#innerdiv");
51            divinn.css("left", 0);
52            divinn.css("top", "66px");
53        }
54        else {
55            var divinn = $("#innerdiv");
56            divinn.css("left", ($(window).width() - o.width) / 2);
57            divinn.css("top", ($(window).height() - o.height) / 2);
58        }
59
60    }
61}
62
63$(document).ready(function () {
64    $("#bigimg").bind("mousewheel",
65        function () {
66            zoomImg(this);
67            return false;
68        });
69});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.