/********************屏幕自适应**********************/ var viewport = { init: function(width) { var thi = this; thi.width = width; $(window).on('orientationchange resize', function(e) { thi.set(); }); thi.set(); }, set: function() { var thi = this; $('meta[name="viewport"]').remove(); if(thi.orient()){ var phonewidth = parseint(window.screen.height); }else{ var phonewidth = parseint(window.screen.width); } var phonescale = phonewidth / thi.width; var useragent = navigator.useragent; var index = useragent.indexof('android'); if (index >= 0) { var androidversion = parsefloat(useragent.slice(index+8)); if (androidversion > 2.3) { $('head:eq(0)').append(''); } else { $('head:eq(0)').append(''); } } else { $('head:eq(0)').append(''); } // $('html').css({margin:'auto', width:thi.width}); }, orient: function() { if (window.orientation == 90 || window.orientation == -90) { return 1; } else if (window.orientation == 0 || window.orientation == 180) { return 0; } } }; viewportwidth=typeof(viewportwidth)=='undefined'?750:(viewportwidth||750); viewport.init(viewportwidth); /********************屏幕自适应**********************/