zoukankan      html  css  js  c++  java
  • 【原创】Jquery.Greybox.js(Jquery框架下的Greybox源代码)

    function GB_show(title, url, width, height, scroll) {
        var GB_HEIGHT = height || 400;
        var GB_WIDTH = width || 400;
        var scroll = scroll == null ? 'no' : scroll;
        var html = "\
                <div id='GB_overlay'><iframe id='GB_bgframe' scrolling='no' frameborder='0'></iframe></div>\
                <div id='GB_window'>\
                <div id='GB_caption'>" + title + "</div>\
                <img id='GB_closeimg' src='/images/greybox/close.gif' alt='Close window'/>\
                <img id='GB_loading' src='/Images/greybox/indicator.gif' align='absmiddle'/>\
                <iframe id='GB_frame' src='" + url + "' scrolling='" + scroll + "'></iframe>\
                </div>\
                ";
        $(document.body).append(html);
        $("html").css("overflow", "hidden");

        //position
        var GB_de = document.documentElement;
        var GB_w = Math.max(GB_de.offsetWidth, document.body.scrollWidth, GB_de.scrollWidth);
        var GB_h = Math.max(GB_de.offsetHeight, document.body.scrollHeight, GB_de.scrollHeight);
        var scrollleft = Math.max(GB_de.scrollLeft, document.body.scrollLeft);
        var scrolltop = Math.max(GB_de.scrollTop, document.body.scrollTop);
        var GB_left = ((GB_de.clientWidth - GB_WIDTH) / 2) + scrollleft;
        var GB_top = ((GB_de.clientHeight - GB_HEIGHT) / 2) + scrolltop;

        $("#GB_overlay").css({ GB_w + "px", height: GB_h + "px" });
        $("#GB_window").css({ GB_WIDTH + "px", height: GB_HEIGHT + "px", top: GB_top + "px", left: GB_left + "px" });
        $("#GB_frame").css({ height: GB_HEIGHT - 22 + "px" });

        //bind event
        $("#GB_window img").click(GB_hide);
        $("#GB_frame").load(function() { $("#GB_loading").hide(); $("#GB_frame").show(); });
        $("#GB_caption").mousedown(function(event) {
            var oObj = document.getElementById("GB_window");
            var oEvent = window.event || event;
            var dragData = { x: oEvent.clientX, y: oEvent.clientY };
            var backData = { x: parseInt(oObj.style.top), y: parseInt(oObj.style.left) };
            if ($.browser.msie) oObj.setCapture();
            oObj.onmousemove = function(event) {
                oEvent = window.event || event;
                var iLeft = oEvent.clientX - dragData["x"] + parseInt(oObj.style.left);
                var iTop = oEvent.clientY - dragData["y"] + parseInt(oObj.style.top);
                oObj.style.left = iLeft + "px";
                oObj.style.top = iTop + "px";
                dragData = { x: oEvent.clientX, y: oEvent.clientY };
            }
            oObj.onmouseup = function(event) {
                oEvent = window.event || event;
                oObj.onmousemove = null;
                oObj.onmouseup = null;
                if (oEvent.clientX < 1 || oEvent.clientY < 1 || oEvent.clientX > document.documentElement.clientWidth || oEvent.clientY > document.documentElement.clientHeight) {
                    oObj.style.left = backData.y + "px";
                    oObj.style.top = backData.x + "px";
                }
                if ($.browser.msie) oObj.releaseCapture();
            }
        });
    }

    function GB_hide() {
        $("#GB_window,#GB_overlay").remove();
        $("html").css("overflow", "auto");
    }

  • 相关阅读:
    BZOJ 3105: [cqoi2013]新Nim游戏
    informatica增量抽取图文
    informatica ETL增量抽取(时间戳)
    kafka connector 使用总结以及自定义connector开发(×××××)
    Kafka Connect JDBC-Source 源连接器配置属性
    kafka-connect-jdbc-sink配置属性
    得到自1970年1月1日以来的秒数
    kafka-connect-jdbc(重要)
    confluent kafka-connect-jdbc(非常重要)
    kafka集群版 connectors 通过REST API实现控制
  • 原文地址:https://www.cnblogs.com/cosiray/p/1587259.html
Copyright © 2011-2022 走看看