【问题标题】:How to change the default behavior of the ThickBox?如何更改ThickBox 的默认行为?
【发布时间】:2010-06-29 08:53:42
【问题描述】:

我在一页中使用Thickbox,
现在你知道了,如果我们点击thickbox页面的外侧[意味着在黑色部分],

所以我想删除那个行为,我想删除那个东西......意味着如果用户在黑暗部分点击了该页面的一侧,那么页面不应该被删除 - 消失,它应该留在窗口..

通过单击“关闭”链接关闭厚框页面的唯一方法,

他们有什么办法做到这一点吗?

提前致谢,
尼兹。

【问题讨论】:

  • 只需在 url 末尾添加 &modal。 #TB_inline?height=300&width=400&inlineId=pleaseloginagain&modal=true

标签: thickbox


【解决方案1】:

我知道这是一个老问题,但我找到了另一种方法来做到这一点,而无需更改thickbox源代码,在我启动thickbox窗口后,我执行以下操作:

tb_show('', 'website.php?inlineId=hiddenModalContent&TB_iframe=true');
jQuery("#TB_overlay").off('click');

这会移除点击动作,所以它变成了一个模态窗口,而不会丢失标题栏。

【讨论】:

    【解决方案2】:

    在Thickbox.js 中转到函数tb_show

    在这个 if 语句中:

        if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
            $("body","html").css({height: "100%", width: "100%"});
            $("html").css("overflow","hidden");
            if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
                $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
                $("#TB_overlay").click(tb_remove);  //Remove me
            }
        }else{//all others
            if(document.getElementById("TB_overlay") === null){
                $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
                $("#TB_overlay").click(tb_remove); //Remove me
            }
        }
    

    您需要注释掉包含$("#TB_overlay").click(tb_remove); 的两行。我在您应该注释掉的行上添加了//Remove Me 的注释。

    【讨论】:

      【解决方案3】:

      这可以帮助你:-)

      $("#TB_overlay").unbind("click",tb_remove);
      

      【讨论】:

        猜你喜欢
        • 2023-03-27
        • 1970-01-01
        • 2016-07-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-11-11
        • 2017-12-30
        • 1970-01-01
        相关资源
        最近更新 更多