Javascript -webkit背景尺寸不小于';不能使用jQuery Css

Javascript -webkit背景尺寸不小于';不能使用jQuery Css,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我试图加载页面加载后的背景,但它似乎没有工作,因为我期待 我以前在css中的代码是: html { background: url(<?php echo $this->Cdn->getUrl(); ?>/images/photos/bg-blurred.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover;

我试图加载页面加载后的背景,但它似乎没有工作,因为我期待

我以前在css中的代码是:

html {
    background: url(<?php echo $this->Cdn->getUrl(); ?>/images/photos/bg-blurred.jpg) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    background-color: #0c1d31;
}
html{
背景:url(/images/photos/bg.jpg)无重复中心固定;
-webkit背景尺寸:封面;
-moz背景尺寸:封面;
-o-背景尺寸:封面;
背景尺寸:封面;
背景色:#0c1d31;
}
现在我用jQuery进行了尝试:

jQuery(document).ready(function () {

    jQuery('html').css({
        'background-image': "url('<?php echo $this->Cdn->getUrl(); ?>/images/photos/bg-blurred.jpg')",
        'background-size': "cover",
        'background-color': "#0c1d31",
        '-webkit-background-size': "cover",
        '-moz-background-size': "cover",
        '-o-background-size': "cover",

    }); 
});
jQuery(文档).ready(函数(){
jQuery('html').css({
'背景图像':“url('/images/photos/bg.jpg')”,
“背景尺寸”:“封面”,
“背景色”:“0c1d31”,
“-webkit背景尺寸”:“封面”,
“-moz背景大小”:“封面”,
“-o-背景尺寸”:“封面”,
}); 
});
使用jQuery.css时,'-webkit background size'和'-moz background size'和'-o-background-size'似乎不起作用。其他css属性工作正常

有什么想法吗?

如果您只尝试使用“-webkit背景尺寸”:

您将看到您的元素如下所示:

<html style="background-size: cover;">

所以这不是你的问题

您可能应该查找您的url:

"url('<?php echo $this->Cdn->getUrl(); ?>/images/photos/bg-blurred.jpg')"
“url('/images/photos/bg.jpg')”

如果您使用的是chrome,请在网络选项卡内的f12中进行检查,以查看是否没有错误。

很抱歉,这是我的错误。我的JS中缺少一些代码

    jQuery('html').css({
        'background-image': "url('<?php echo $this->Cdn->getUrl(); ?>/images/photos/bg-blurred.jpg')",
        "background-repeat": "no-repeat",
        "background-position": "center center",
        "background-attachment": "fixed",
        'background-size': "cover",
        'background-color': "#0c1d31",
        '-webkit-background-size': "cover",
        '-moz-background-size': "cover",
        '-o-background-size': "cover",
    });
jQuery('html').css({
'背景图像':“url('/images/photos/bg.jpg')”,
“背景重复”:“不重复”,
“背景位置”:“中心”,
“背景附件”:“已修复”,
“背景尺寸”:“封面”,
“背景色”:“0c1d31”,
“-webkit背景尺寸”:“封面”,
“-moz背景大小”:“封面”,
“-o-背景尺寸”:“封面”,
});

很好。

请在代码中添加一个起点,以便正确快速地回答您的问题。另请参见@Roy我不明白我的问题出了什么问题?既然浏览器已经有一段时间不需要前缀了,为什么还要麻烦呢?不,问题不在这里。背景图像加载良好。只有定心(盖)失效的问题。我已经用普通的css代码更新了我的问题。
    jQuery('html').css({
        'background-image': "url('<?php echo $this->Cdn->getUrl(); ?>/images/photos/bg-blurred.jpg')",
        "background-repeat": "no-repeat",
        "background-position": "center center",
        "background-attachment": "fixed",
        'background-size': "cover",
        'background-color': "#0c1d31",
        '-webkit-background-size': "cover",
        '-moz-background-size': "cover",
        '-o-background-size': "cover",
    });