$(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('/'); }) function placeholderSupport() { return 'placeholder' in document.createElement('input'); } function scrollT($Dom){ if($Dom.offset()){ if($(window).scrollTop()+$(window).height()>=$Dom.offset().top+200){ return true; } } } 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 addEvent(eve,callback){ if (window.attachEvent){ window.attachEvent("on"+eve,callback); }else if(window.addEventListener) { window.addEventListener(eve,callback,false); } } //鍒ゆ柇pad妯睆绔栧睆锛屽埛鏂伴〉闈 addEvent('load', function(){ // orientationChange(); window.onorientationchange = orientationChange; }); 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; } }; //鑾峰彇IE娴忚鍣ㄧ増鏈 function getBrowserVersion(){ var hc = $('html').attr('class'); if(hc){ var ieVersion = hc && hc.split(' ')[1]; if(ieVersion){ $('.browserupgrade>strong').text(ieVersion.toUpperCase()); } } } getBrowserVersion(); //榧犳爣寤惰繜鎵ц浜嬩欢鏂规硶 $.fn.hoverDelay = function(options){ var defaults = { hoverDuring: 200, outDuring: 200, hoverEvent: function(){ $.noop(); }, outEvent: function(){ $.noop(); } }; var sets = $.extend(defaults,options || {}); var hoverTimer, outTimer, that = this; return $(this).each(function(){ $(this).on('mouseenter',function(){ clearTimeout(outTimer); hoverTimer = setTimeout(function(){sets.hoverEvent.apply(that)}, sets.hoverDuring); }); $(this).on('mouseleave',function(){ clearTimeout(hoverTimer); outTimer = setTimeout(function(){sets.outEvent.apply(that)}, sets.outDuring); }); }); } $('header .con .lang').on('click',function(){ $(this).children('.other_lang').slideToggle() }) $('header').hover(function(){ $('header').addClass('active') },function(){ if (window.scrollY <= 10){ $('header').removeClass('active') } }) window.addEvent('scroll',function () { if (window.scrollY <= 10){ if(!$('header .menu_btn').hasClass('on')){ $('header').removeClass('active'); } } else { $('header').addClass('active'); } }); $('header .menu_btn').on('click',function () { $(this).toggleClass('on'); $('header .con nav').stop().slideToggle(); if($(this).hasClass('on')){ $('header').addClass('active') }else if(window.scrollY <= 10){ //$('header').removeClass('active'); } }) /* 浜у搧涓績鍒囨崲 */