通过User-Agent判断
代码:
if(navigator.userAgent.match(/mobile/i)) { //业务层代码 $('body').removeClass("sidebar-open"); }