$(".addon-checkbox").style.backgroundPosition =
if(localStorage["__Enable__"+__addons[i]] != "yes") "0 -50px";
else "0 0";
如何使此代码正确?
答案 0 :(得分:2)
jQuery对象没有style
属性?
var bg = localStorage["__Enable__"+__addons[i]] != "yes" ? "0 -50px" : "0 0";
$(".addon-checkbox").css('background-position', bg);
答案 1 :(得分:0)
也许:
$(".addon-checkbox").get().style.backgroundPosition =
(localStorage["__Enable__"+__addons[i]] != "yes") ? "0 -50px" : "0 0";