$(function(){ //判断是否是pc var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone","SymbianOS", "Windows Phone","iPad", "iPod"]; function IsPC() { var flag = true; for (var v = 0; v < Agents.length; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } } return flag; }; var flag_pad = false; if (userAgentInfo.indexOf("iPad")>0 || userAgentInfo.indexOf("iPod")>0){ flag_pad = true; } function showApp(){ var winWidth = $(window).width(); if (winWidth < 750) { $("html").css({"zoom":"+winWidth/774+","transform":"scale("+winWidth/750+")","transform-origin": "top left"}); } else{ $("html").css({"zoom":"","transform":""}); } } function showpad(){ var viewportmeta = document.querySelector('meta[name="viewport"]'); if (viewportmeta) { viewportmeta.content = "width=1280,target-densitydpi=device-dpi"; } $("html").css({"zoom":"","transform":"","height":"100%"}); } var isPC=IsPC(); if(isPC){ showApp(); window.onresize=function () { showApp(); } } if(flag_pad){ showpad(); orient(); } //判断ipad请求桌面站点(显示pc版) var userAgentInfo = navigator.userAgent; if (userAgentInfo.indexOf('Macintosh') > 0 ) { showpad(); orient(); } if (window.attachEvent) { window.attachEvent("onorientationchange" in window ? "orientationchange" : "resize", orient, false); } else if (window.addEventListener) { window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", orient, false); } function orient() { if (window.orientation == 0 || window.orientation == 180) { if(window.localStorage.getItem('name')=='a'){ if(flag_pad){ showpad(); } window.localStorage.setItem('name','b'); } orientation = 'portrait'; return false; } if (window.orientation == 90 || window.orientation == -90) { if(flag_pad){ showpad(); } window.localStorage.setItem('name','a'); orientation = 'landscape'; return false; } } if(isPC){ $(".model").height($(document).height()-124); }else{ $(".model").height($(window).height()-124); } })