JS遍历

来源:互联网 发布:书记员速录软件 编辑:程序博客网 时间:2024/05/21 19:42

$(window).load(function() {
$(".cur").each(function(){
if($(this).width()>$(this).height())
{
$(this).css({"height": "100%","margin-left":"-15%"});
}
else {
$(this).css({"width":"100%","margin-top":"-15%"});
}
})

});

多用this,少用选择器
0 0