var ltIE10 = (function() { var theUA = window.navigator.userAgent.toLowerCase(); if ( (theUA.match(/msie\s\d+/) && theUA.match(/msie\s\d+/)[0]) || (theUA.match(/trident\s?\d+/) && theUA.match(/trident\s?\d+/)[0]) ) { var ieVersion = theUA.match(/msie\s\d+/)[0].match(/\d+/)[0] || theUA.match(/trident\s?\d+/)[0]; if (ieVersion < 10) { return true; } else { return false; } } })(); // if (ltIE10) { // window.location.href = "ie.html"; // } var shuwon = { percent: 0, timers: "", init: function (e) { $("body").append('
'); // // 鍔犺浇鍔ㄧ敾 this.common(); this.backTop(); $('.navBox').click(function (e) { $('.navMobile').toggleClass('active') }) }, /** * 椤甸潰鍔犺浇瀹屾瘯 */ loaded: function () { $('#loading').addClass('active'); }, index:function(){ }, common:function(){ }, getOffset:function(){ if($(window).width()>1200){ return ($(window).width() - 1200) / 2 }else{ return 0; } }, /** * 杩斿洖椤堕儴 */ backTop: function () { var offset = 300, offset_opacity = 1200, scroll_top_duration = 500, $back_to_top = $('.backTop'); $(window).scroll(function () { ($(this).scrollTop() > offset) ? $back_to_top.addClass('active'): $back_to_top.removeClass('active'); if ($(this).scrollTop() > offset_opacity) { $back_to_top.addClass('active') } }); $back_to_top.on('click', function (event) { event.preventDefault(); $('body,html').animate({ scrollTop: 0 }, scroll_top_duration) }) }, /** * 闅忔満杩斿洖鍖洪棿鍊 * min:鏈€灏忓€ * max:鏈€澶у€ */ rand: function (min, max) { return Math.random() * (max - min) + min; }, /** * 楠岃瘉鎵嬫満鍙风爜 * @param {obj} 浼犲叆鐨勬墜鏈哄彿鐮 * @return 姝g‘杩斿洖true 閿欒杩斿洖false */ regPhone: function (obj) { reg = /^(13|15|17|18|14)[0-9]{9}$/; return reg.test(obj); }, /** * 鍒ゆ柇楠岃瘉鐮佹槸鍚︾鍚堣姹 */ regCode: function (obj) { if (obj.length == 0 || obj.length != 6) { return true; } return false; }, /** * 鍙兘杈撳叆涓嫳鏂囧拰鏁板瓧 */ regName: function (obj) { var reg = /^[\u4e00-\u9fa5]{2,20}$/; return reg.test(obj); }, /** * 濮撳悕 || 鍙兘杈撳叆涓嫳鏂 * @param {obj} 浼犲叆鐨勫瓧绗 * @return 姝g‘杩斿洖true 閿欒杩斿洖false */ regName: function (obj) { reg = /^[\u4E00-\u9FA5A-Za-z]+$/;; return reg.test(obj); }, /** * 鍒ゆ柇韬唤璇佸彿鐮佹槸鍚︾鍚堣姹 */ regID: function (obj) { reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; return reg.test(obj); }, /** * 鎻愮ず淇℃伅 * @msg 鎻愮ず鐨勪俊鎭 * @success true 鎴愬姛 | false 澶辫触 */ toast: function (msg, sucess) { $(".toast").addClass("active").find("span").html(msg); if (!sucess) { $(".toast").addClass("warn"); } else { $(".toast").removeClass("warn"); } setTimeout(function () { $(".toast").removeClass("active") }, 1500) }, /** * 鑾峰彇鍦板潃鏍 * @name 鑾峰彇浼犲叆鐨勫弬鏁 */ getUrlParam: function (name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); return r ? decodeURIComponent(r[2]) : null; }, /** * 鍊掕鏃 */ countDownTime: function () { isClick = false; $('.yzmBtn').addClass("enable"); $('.yzmBtn').addClass("active").html('60绉掑悗閲嶆柊鑾峰彇') var waitTime, currTime = 59; var interval = setInterval(function () { shuwon.timeChange(currTime); currTime--; if (currTime < 0) { clearInterval(interval); currTime = waitTime; } }, 1000); }, /** * 鏃堕棿鎴宠浆鏃堕棿 * * @param {any} timer */ Timer: function (timer) { var timeBpx = { Month: 0, //寮€濮?鏈堜唤 Date: 0, //寮€濮?鍙锋暟 Hours: 0, //寮€濮?灏忔椂 Minutes: 0, //寮€濮?鍒嗛挓 day: 0, //鍓╀綑-澶╂暟 hour: 0, //鍓╀綑-灏忔椂 minute: 0, //鍓╀綑-鍒嗛挓 second: 0 //鍓╀綑-绉 } var current = Math.floor(new Date().getTime() / 1000), TimeD = 0, time = new Date(timer * 1000); var dd_ = 0, hh_ = 0, mm_ = 0, ss_ = 0; TimeD = timer - current; dd_ = Math.floor(TimeD / (60 * 60 * 24)); //璁$畻鍓╀綑鐨勫ぉ鏁 hh_ = Math.floor(TimeD / (60 * 60)) - (dd_ * 24) //璁$畻鍓╀綑鐨勫皬鏃舵暟 mm_ = Math.floor(TimeD / 60) - (dd_ * 24 * 60) - (hh_ * 60) //璁$畻鍓╀綑鐨勫垎閽熸暟 ss_ = Math.floor(TimeD) - (dd_ * 24 * 60 * 60) - (hh_ * 60 * 60) - (mm_ * 60) //璁$畻鍓╀綑鐨勭鏁 if (hh_ <= 9) hh_ = '0' + hh_; if (mm_ <= 9) mm_ = '0' + mm_; if (ss_ <= 9) ss_ = '0' + ss_; timeBpx.day = dd_ //澶 timeBpx.hour = hh_ //鏃 timeBpx.minute = mm_ //鍒 timeBpx.second = ss_ //绉 timeBpx.Month = time.getMonth() + 1 timeBpx.Date = time.getDate() timeBpx.Date = time.getHours() timeBpx.Date = time.getMinutes() return timeBpx }, /** * 鑾峰彇鏁版嵁 * @url 浼犲叆鐨勬暟鎹帴鍙 * @para 浼犲叆鐨勫弬鏁 */ getDataForApi: function (url, para, callback) { $.ajax({ type: "post", data: para, url: 'http://shuwon.ishuwon.cn' + url, dataType: 'json', success: function (data) { if (data.result) { callback(data) } else { shuwon.toast(data.msg); } }, error: function (e) { shuwon.toast("鏁版嵁鍔犺浇閿欒", false) } }) }, /** *浜岀骇瀵艰埅璺宠浆 * * @param {*} type default hash */ navigation:function(type){ var t = type || 'hash'; if(t == 'hash'){ $('.nav_list .nav_item').each(function(i){ $(this).attr('data-offset',$('.commonpage .box').eq(i).offset().top) }) $('.nav_list .nav_item').click(function(){ var top = $(this).attr('data-offset'); $('body,html').animate({scrollTop:top},500) }) }else{ $('.nav_list .nav_item').click(function(){ var link = $(this).attr('data-link'); location.href = link }) } }, scrollFollow:function(){ var offset = $('.nav_').offset().top + 190 document.addEventListener('scroll',function(){ var scrollTop = $(window).scrollTop() if(scrollTop > offset){ $('.nav_').addClass('fixed') }else{ $('.nav_').removeClass('fixed') } },false) }, /** * 瑙嗛寮瑰嚭灞 */ video:function(){ $(".video_list ul li").click(function(){ $(".lightBox").addClass("active"); $(".lightBox video").attr("src", $(this).attr("data-url")); }) $(".close_video").click(function(){ $(".lightBox").removeClass("active"); $(".lightBox video").attr("src", ""); }) }, /** * 鍔犲叆鎴戜滑寮瑰嚭灞 */ join:function(){ $(".join_list ul li").click(function(){ $(".lightBox").show() }) $(".joinTipBoxTitle .close").click(function(){ $(".lightBox").hide() }) }, } shuwon.init()