function isPC () { var userAgentInfo = navigator.userAgent; var Agents = ["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; } if (isPC()) { if (location.pathname === '/mobile/yq_cykj.html') { //location.href = '/yq_cykj.html'; } //location.href = '../index.html'; } // 鎸夐挳active $('body').on('touchstart', '.btn', function () { var $this = $(this); $this.addClass('f-active'); setTimeout(function () { $this.removeClass('f-active'); }, 100) }) // 寮瑰嚭鍏抽棴 $('body').on('click', '.m-popup .close, .m-popup .j-close', function () { $(this).parents('.m-popup').hide(); }) // loading function showLoading (text) { var info = text ? '

' + text + '

' : ''; hideLoading(); $('body').append('
' + info + '
'); } function hideLoading () { $('.f-loading').remove(); } // 娑堟伅鎻愮ず function showToast (text, duration) { $('body').append('

' + text + '

'); window.toastTimer = setTimeout(function () { $('.f-toast').remove(); }, duration || 2000) } function hideToast () { clearTimeout(window.toastTimer); $('.f-toast').remove(); } function ajax (options) { var data = { type: options.type || 'POST', url: apiUrl + (options.url || ''), data: options.data || {}, dataType: 'json', success: function (res) { if (options.success) { options.success(res); } }, error: function (res) { console.log(res) hideLoading(); showToast(data.url + '璇锋眰澶辫触'); } } $.ajax(data) }