一个分辨率懒惰小技巧

response('page768','page1024','page1280','page1366','page1440','page1660');

$(window).on('resize',function(){

response('page768','page1024','page1280','page1366','page1440','page1660');

});

// 判断屏幕宽度

function response(){

var ww=$(window).width();

var cname="page768";

for(var x in arguments){

arguments[x]=arguments[x].replace("page","");

if(ww>=arguments[x]){

cname="page"+arguments[x];

}

}

$("html").attr("class",cname);

}

 

你可能感兴趣的:(前端,css)