jquery 操作CSS每次循环累加数值问题

omit.mouseenter(function () {

for (i = 0; i < navLi_1_omit.length; i++) {
topPx += 48;
$(navLi_1_omit[i]).addClass("omit_type").css({ display: "block", top: " 这里写什么" });

}

})
=====PS:
我想每次循环i后top:这个值都加48,该怎么写

第1个回答  推荐于2016-06-17
omit.mouseenter(function () {

for (i = 0; i < navLi_1_omit.length; i++) {
topPx += 48;
$(navLi_1_omit[i]).addClass("omit_type").css({ display: "block", top: topPx+"px" });
}
})
这里写什么用topPX代替。然后加个单位。
注意引号的使用本回答被提问者采纳
第2个回答  2014-09-25
" 这里写什么" 写成 +=48,试试。