【问题标题】:Resize thickbox调整厚盒大小
【发布时间】:2012-02-09 08:27:39
【问题描述】:

我尝试创建一个 WordPress TinyMCE 插件,它将使用厚框来显示弹出对话框。

现在,我想知道是否有一种方法可以根据屏幕大小而不是基于宽度和高度的静态值来调整Thickbox 的大小,我可以在插件开发中给出。

有什么想法吗?

【问题讨论】:

  • 有关Thickbox 和TinyMCE 的问题不是本网站的主题问题,因为它们不直接涉及WordPress。迁移到 Stack Overflow,您可能会得到更好的建议。

标签: thickbox


【解决方案1】:

好的,我找到了解决方案,我把它放在这里以供其他成员将来使用。

我将以下代码插入到 TinyMCE 插件代码中:

ed.addCommand(
    'openPluginDialog', 
    function()
    {
        var w = window.innerWidth;        // Get the inner window width
        var h = window.innerHeight;       // Get the inner window height

        w = (w * 90) / 100;               // Calculate the dialog width
        h = (h * 85) / 100;               // Calculate the dialog height

        ed.windowManager.open(
            {
                file : url + '/plugin_dialog.html',
                width : w,                // The calculated window width
                height : h,               // The calculated window height
                inline : 1,
                title: 'Plugin dialog title'
            },
            {
                plugin_url : url
            }
        );
    }
);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多