【问题标题】:JQuery attribute change of CSS wont work in ChromeCSS 的 JQuery 属性更改在 Chrome 中不起作用
【发布时间】:2011-05-03 07:26:06
【问题描述】:

我正在使用 coda-slider 并更改 css 文件中的面板大小 trought JQuery。我这样做是为了将 coda-slider 调整为大小窗口。 这在 Firefox 中运行良好,但会使 Chrome 和 Safari 崩溃。 有谁知道我该如何解决这个问题?

这是函数

function resizeCentro() {
        var alt = (document.height * 0.95) + "px";
        var larg = (document.width * 0.77) + "px";

        $(".coda-slider").css('width', larg);
        $(".coda-slider").css('height', alt);

        $(".panel-wrapper").css('width', larg);
        $(".panel-wrapper").css('height', alt); 

        document.getElementById("ifInicio").width = document.width * 0.95;
        document.getElementById("ifInicio").height = document.height * 0.95;
        document.getElementById("ifInicio").src = "inicio.html";

}

页面可以在http://www.segundafeirafilmes.com.be/prov/INDEX.html查看

【问题讨论】:

  • jQuery 在哪里?如果您使用该库,请使用它。
  • 该链接重定向到根目录,其中包含大量弹出窗口,通常看起来应该避免。

标签: jquery css firefox google-chrome safari


【解决方案1】:

使用 moar jQuery:

function resizeCentro() {
    $(".coda-slider, .panel-wrapper").width($(document).width() * 0.77;);
    $(".coda-slider, .panel-wrapper, #ifInicio").height($(document).height() * 0.95);

    $("#ifInicio").width($(document).width() * 0.95);
    $("#ifInicio").attr('src', "inicio.html");
}

【讨论】:

  • 仍然无法正常工作......仍然在 chrome 和 safari 中崩溃。在 IE 中冻结 ajax“加载”。还有什么想法吗?我已经更新了 www.segundafeirafilmes.com.br/prov/INDEX.html 中的页面
  • 看来 chrome 不支持 jquery。有什么办法可以发现吗?或者改变我改变css类属性的方式?
  • 使用 Chrome 对我来说效果很好。通过 W3C Unicorn Validator 运行它以查看任何标记错误。另外,我怀疑加载 7 个 JS 文件是否会对性能有所帮助。
【解决方案2】:

document.widthdocument.height 是其他浏览器不一定实现的非标准 Netscape 4 时代 DOM0。特别是,WebKit 没有实现它们。 Firefox 6 也将放弃对它们的支持。

【讨论】:

  • FF6?哇,Mozilla 真的在提前计划!
  • Firefox 6 计划从现在开始不到 4 个月。 Firefox 5 功能齐全,已经使用了 3 周,计划从现在开始大约一个半月后发货。或者换一种说法,这个问题中的代码将在 8 月中旬停止在 Firefox 中运行。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-04-18
  • 2016-06-06
  • 1970-01-01
  • 1970-01-01
  • 2014-06-04
  • 1970-01-01
相关资源
最近更新 更多