$(function(){ // if(!placeholdersupport()){ // $('[placeholder]').focus(function() { // var input = $(this); // if (input.val() == input.attr('placeholder')) { // input.val(''); // input.removeclass('placeholder'); // } // }).blur(function() { // var input = $(this); // if (input.val() == '' || input.val() == input.attr('placeholder')) { // input.addclass('placeholder'); // input.val(input.attr('placeholder')); // } // }).blur(); // }; if(!ispc()){$('body').addclass('touch_body')} //ie浏览器 if(isie()){$('html').addclass('isie');} // 获取当前url var url_location = window.location.pathname; var arr = []; arr = url_location.split('/'); //获取地址栏参数 //判断pad横屏竖屏,刷新页面 addeventlistener('load', function(){ // orientationchange(); window.onorientationchange = orientationchange; }); if(!ispc()){ if($(window).height()==812){ $('body').addclass('phonex') } if($(window).height()==1366){ $('body').addclass('h1366') } if($(window).height()==1024){ $('body').addclass('h1024') } } }) // function placeholdersupport() { // return 'placeholder' in document.createelement('input'); // } function scrollt($dom){ if($(window).scrolltop()+$(window).height()>=$dom.offset().top+200){ return true; } } function getquerystring(name) { var reg = new regexp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } function mainbgresize1($img, width, height, w_b, h_b) { var sw = width, sh = width / w_b * h_b if (sh < height) { sh = height; sw = height / h_b * w_b } $img.css({height:sh,width:sw, margintop: -(sh - height) / 2, marginleft: -(sw - width) / 2, 'visibility': 'visible' }); } //判断是否firefox浏览器 function isfirefox(){ if (navigator.useragent.indexof("firefox") > -1) return true; else return false; } //判断是否ie浏览器 function isie() { if (!!window.activexobject || "activexobject" in window) return true; else return false; } function ispc() { var useragentinfo = navigator.useragent; var agents = new array("android", "iphone", "symbianos", "windows phone", "ipad", "ipod"); var flag = true; for (var v = 0; v < agents.length; v++) { if (useragentinfo.indexof(agents[v]) > 0) { flag = false; break; } } return flag; } function maxheight(domh){ domh.attr("style", ""); var narray = new array(); domh.each(function () { narray.push($(this).innerheight()); }) domh.css({ "height": math.max.apply(null, narray) }) } function initevent(classna) { $(classna).each(function () { var $this = $(this), holder = $this.data('holder'); if (holder) { $this.css('color', '#626268').val(holder); } }); //获取焦点时设置内容的颜色和值为空 $(document).off('focus', classna).on('focus', classna, function () { var $this = $(this); if ($this.val() === $this.data('holder')) { $this.css({ 'color':'#fff', 'backgroundcolor':'transparent' }).val(''); }else{ $this.css({ 'color':'#fff', 'backgroundcolor':'transparent' }).val($this.val()); } }); //失去焦点后还原提示内容 $(document).off('focusout', classna).on('focusout', classna, function () { var $this = $(this); if ($.trim($this.val()) === '') { $this.css({ 'color':'#626268', 'backgroundcolor':'transparent' }).val($this.data('holder')); }else{ $this.css({ 'color':'#fff', 'backgroundcolor':'transparent' }).val($this.val()); } }); } function orientationchange() { switch(window.orientation) {   case 0: //alert("肖像模式 0,screen-width: " + screen.width + "; screen-height:" + screen.height); window.location.reload(); break;   case -90: //alert("左旋 -90,screen-width: " + screen.width + "; screen-height:" + screen.height); window.location.reload(); break;   case 90: // alert("右旋 90,screen-width: " + screen.width + "; screen-height:" + screen.height); window.location.reload(); break;   case 180:   //alert("风景模式 180,screen-width: " + screen.width + "; screen-height:" + screen.height); window.location.reload();   break; } };