$(function () { console.log(111) // tabbar-item 为一个时移除tabbar-item-active if ($('.tabbar-item').length == 1) { $('.tabbar-item').removeclass('tabbar-item-active'); } $(document).on('click', '.tabbar-item', function () { $('.tabbar-item').removeclass('tabbar-item-active'); // console.log($(this).index()) $(this).addclass('tabbar-item-active'); var text = $(this).text() $('.content-nav-item').eq(1).find('span').text(text) }); // 返回顶部图标是否存在 if ($('.totop').length) { $(document).scroll(function () { var scroh = $(document).scrolltop(); //滚动高度 var viewh = $(window).height(); //可见高度 var contenth = $(document).height(); //内容高度 var disp = $('.totop').css('display'); if (scroh >= 400 && disp == 'none') { //距离顶部大于100px时 $('.totop').show(); } if (scroh < 400 && disp == 'block') { $('.totop').hide(); } // if (contenth - (scroh + viewh) <= 100) { //距离底部高度小于100px // $('.totop').hide(); // } // if (contenth == (scroh + viewh)) { //滚动条滑到底部啦 // } }); $('.totop').click(function () { $('html').animate({ scrolltop: 0 }, 500); }) } }); function request () { $.ajax( { type: "", url: '', success: "", data: { } } ) } function getrequest (urlstr) { if (typeof urlstr == "undefined") { var url = decodeuri(location.search); //获取url中"?"符后的字符串 } else { var url = "?" + urlstr.split("?")[1]; } var therequest = new object(); if (url.indexof("?") != -1) { var str = url.substr(1); strs = str.split("&"); for (var i = 0; i < strs.length; i++) { therequest[strs[i].split("=")[0]] = decodeuri(strs[i].split("=")[1]); } return therequest } } function gourl(url) { location=url } var os = function() { var ua = navigator.useragent, iswindowsphone = /(?:windows phone)/.test(ua), issymbian = /(?:symbianos)/.test(ua) || iswindowsphone, isandroid = /(?:android)/.test(ua), isfirefox = /(?:firefox)/.test(ua), ischrome = /(?:chrome|crios)/.test(ua), istablet = /(?:ipad|playbook)/.test(ua) || (isandroid && !/(?:mobile)/.test(ua)) || (isfirefox && /(?:tablet)/.test(ua)), isphone = /(?:iphone)/.test(ua) && !istablet, ispc = !isphone && !isandroid && !issymbian; return { istablet: istablet, isphone: isphone, isandroid : isandroid, ispc : ispc }; }(); if(os.isandroid || os.isphone){ var url=window.location.pathname; if(url.indexof('index.php')==-1){ url='/index.php/mobile/index/index' }else{ url=url.replace(/\/index\.php\//, "\/index\.php\/mobile\/") } // alert(url) gourl(url); }