$(window).on('load', function() { //入场动效 //左侧进入渐显 var wow01 = new wow({ boxclass: 'wow01', animateclass: 'fadeinleft', offset: 100, mobile: true, live: true }); wow01.init(); //右侧进入渐显 var wow02 = new wow({ boxclass: 'wow02', animateclass: 'fadeinright', offset: 100, mobile: true, live: true }); wow02.init(); //由下向上进入渐显 var wow03 = new wow({ boxclass: 'wow03', animateclass: 'fadeinup', offset: 100, mobile: true, live: true }); wow03.init(); //由上向下进入渐显 var wow04 = new wow({ boxclass: 'wow04', animateclass: 'fadeindown', offset: 100, mobile: true, live: true }); wow04.init(); var wow = new wow({ boxclass:'wow' }); wow.init(); var wow_l = new wow({ boxclass:'wow_l', }); wow_l.init(); var wow_r = new wow({ boxclass:'wow_r', }); wow_r.init(); var wow_d = new wow({ boxclass:'wow_d', }); wow_d.init(); }); $(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); }); }); }; $.fn.numberrock=function(options){ var defaults={ speed:24, count:100 }; var opts=$.extend({}, defaults, options); var div_by = 100, count = opts["count"], speed = math.floor(count / div_by), sum = 0, $display = this, run_count = 1, int_speed = opts["speed"]; var int = setinterval(function () { if (run_count <= div_by&&speed!=0) { $display.text(sum=speed * run_count); run_count++; } else if (sum < count) { $display.text(++sum); } else { clearinterval(int); } }, int_speed); } //无图图像 var noimg = '../images/error.jpg'; function imgerror(t) { t.onerror = null; t.src = noimg } function posnav(){ var nowl,now_w; if($(window).width() >= 960){ if($('.nav').find('.active').length > 0){ nowl = $('.nav').find('.active').offset().left; now_w = $('.nav').find('.active').width(); $('.nav').find('.moveline').css({ left:nowl, width:now_w }); } } }