javascript - 仅在 Facebook 中具有无限扩展高度的对话框叠加层

标签 javascript jquery css facebook jquery-ui-dialog

我认为这是一个 !important 问题。我有一个带有这样设置叠加层的对话框:

.ui-widget-overlay 
{
    width: 518px !important;
}

overlay 的高度将根据页面大小在我的 Javascript 中设置(它可以是两种大小之一)

        if (!placeHolderVisibility) {
            //Code

            $('.ui-widget-overlay').addClass('overlayLarge');
        } else {
            //Code

            $('.ui-widget-overlay').addClass('overlaySmall');
        }

这是 overlaySmalloverlayLarge 的 css:

.overlaySmall
{
    height: 985px !important;
}

.overlayLarge
{
    height: 1167px !important;
}

我有其他带有对话框的页面,但它们没有问题。

.ui-widget-overlay 
{
    height: 413px !important;
    width: 510px !important;
}

当我尝试检查 firebug 中的叠加层时,我注意到 !important 不在 css 中,但我无法获得初始高度(它扩展得很快)

编辑 我认为这是 facebook 的自动调整大小问题

FB.init({ appId: appid, status: true, cookie: true, xfbml: true });
        FB.Canvas.setAutoResize(); //<-- Something wrong with this maybe??

有什么建议吗?

最佳答案

应 OP 的要求复制粘贴:

Why are you using !important? It's generally a bad idea with better alternatives.

You just need to use a more-specific CSS selector than the jQuery one, or use the exact same selector but make sure that your CSS comes after jQuery's. Using !important breaks the natural cascading of CSS and makes maintenance much harder (as you're experiencing firsthand).

关于javascript - 仅在 Facebook 中具有无限扩展高度的对话框叠加层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5887419/

相关文章:

javascript - 重写 reduce 方法 js 的问题

javascript - Google Map v3 - getPosition 不是函数

jquery - 如何使用 jquery 向我的 href 链接添加一个 id?

javascript - 在 Javascript/JQuery 中什么是 $.为了?

html - 贴上导航栏跳转

javascript - JS 通过滚动位置移动一个 Div

javascript - 如何在 javascript 中使用 clojurescript 的复杂返回对象

javascript删除事件监听器

javascript - 从数据表中获取长度菜单值

html - 部署后响应式设计在 iPhone 上不起作用