Web/Scripts/graybox.js

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* Greybox Redux Written by: John Resig */
// 全屏显示
function GB_show_full(caption, url, animation) {
    var s = GB_Fun_getWindowSize();
    var ww = Math.round(s.w - (s.w / 100) * 4);
    var hh = Math.round(s.h - (s.h / 100) * 5);
    GB_show(caption, url, hh, ww, animation);
}

// 指定大小显示
function GB_show(caption, url, height, width, animation) {
    // 检查是否已经初始化过Greybox
    var check = $("#GB_overlay");
    if (check.length == 0) {
        $(document.body).append("<div id='GB_overlay'></div><div id='GB_window'><div id='GB_caption'></div><span id='GB_window_Close'>点击关闭</span></div>");
        $("#GB_window_Close").click(GB_hide);
        $("#GB_window").append("<iframe id='GB_frame' src='" + url + "'></iframe>");
    }
    else {
        $("#GB_frame").get(0).src = url;
    }

    $("#GB_caption").html(caption);
    $("#GB_overlay").show();

    // 设置窗口宽高
    $("#GB_window").css({ width: width + "px", height: height + "px" });

    // 设置背景以及窗口有关位置
    GB_position();

    // 显示窗口
    if (animation) $("#GB_window").slideDown("slow");
    else $("#GB_window").show();

    // 绑定事件
    $(window).bind("resize", GB_position);
    $(window).bind("scroll", GB_position);
}

// 关闭
function GB_hide() {
    // 取消事件绑定
    $(window).unbind("resize");
    $(window).unbind("scroll");
    // 隐藏元素
    $("#GB_window").hide();
    $("#GB_overlay").hide();
}

// 获取指定对象的位置
function GB_Fun_objValue(obj) {
    var st = document.documentElement.scrollTop || document.body.scrollTop;     // 滚动条距顶部的距离
    var sl = document.documentElement.scrollLeft || document.body.scrollLeft;   // 滚动条距左边的距离
    var ch = document.documentElement.clientHeight; // 屏幕的高度
    var cw = document.documentElement.clientWidth;  // 屏幕的宽度
    var objH = $("#" + obj).height();   // 浮动对象的高度
    var objW = $("#" + obj).width();    // 浮动对象的宽度
    var objT = Number(st) + (Number(ch) - Number(objH)) / 2;
    var objL = Number(sl) + (Number(cw) - Number(objW)) / 2;
后面还有 39 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。