改变左边的百分比,如果有一定的百分比



同位素给出了一个特定宽度的错误百分比,所以我用jQuery更改它。它的工作,但有些东西是错误的语法,所以我的其他代码不能工作。

function fixIsotope() { 
    if ($('.blok-categorie').css('left') == '24.9573%') {
        $('.blok-categorie').css('left') == '25%') ;
    }
    return this;
}
fixIsotope();

它给我一个:Uncaught SyntaxError: Unexpected token ) error

你的语法不对

function fixIsotope() { 
if ($('.blok-categorie').css('left') == '24.9573%') {
    $('.blok-categorie').css('left','25%') ;
}
return this;
}
fixIsotope();

==不是赋值操作符,它只是进行比较操作。所以,你不能用它来设置值


另外,在第二行

末尾还有一个额外的)

最新更新