// jQuery.event.special.touchstart = { // setup: function(_, ns, handle) { // if (ns.includes("noPreventDefault")) { // this.addEventListener("touchstart", handle, { passive: false }); // } else { // this.addEventListener("touchstart", handle, { passive: true }); // } // } // }; function upNumber(i) { return i < 10 ? '0' + i : i } var date = new Date() var year = date.getFullYear(), month = upNumber(date.getMonth() + 1), day = upNumber(date.getDate()) function tab(dom) { var index = 0; var length = $(dom).find(".tab-btn span").length; var flag = $(window).width() < 768 ? true : false function tabChange(index) { $(dom).find(".tab-btn span").eq(index).addClass('on').siblings().removeClass('on') $(dom).find('.tab-con .tab-item').eq(index).css("display", "block").siblings('.tab-item').css('display', 'none') } $(dom).find(".tab-btn span").hover(function() { index = $(this).index() tabChange(index) if (flag) { $(dom).find(".tab-btn").scrollLeft(120 * (index - 1)) } }) // $(dom).find('.tab-controls .left').click(function() { // index-- // if (index < 0) { // index = length - 1 // } // tabChange(index) // if (flag) { // $(dom).find(".tab-btn").scrollLeft(120 * (index - 1)) // } // }); // $(dom).find('.tab-controls .right').click(function() { // index++ // if (index > length - 1) { // index = 0 // } // tabChange(index) // if (flag) { // $(dom).find(".tab-btn").scrollLeft(120 * (index - 1)) // } // }); } $(function() { // PC 导航菜单 $('.pc_menuCon li').hover(function() { $('ul', this).slideDown(200); }, function() { $('ul', this).slideUp(100); }); // 日期 // $('#date').text(year + '年' + month + '月' + day + '日') // 手机 导航菜单 jQuery('.phone_menu').meanmenu(); // $(window).scroll(function() { // var scrollHeight = $(document).scrollTop(); // if (scrollHeight > 80) { // $('.phone_menu_t,.top_nav').addClass('lighted-fixed'); // } else { // $('.phone_menu_t,.top_nav').removeClass('lighted-fixed'); // } // }); $(".list-tab-title span").hover(function() { var index = $(this).index() $(this).addClass('on').siblings().removeClass('on') $(this).parent().parent().find('.row').eq(index).css("display", "block").siblings('.row').css('display', 'none') }) $(".lnkSelect p").on("click", function(e) { var objDiv = $(this).next('ul'); if (objDiv.css('display') == 'none') { objDiv.css('display', 'block'); objDiv.parent().siblings().find('ul').css('display', 'none'); event.stopPropagation(); } else { objDiv.css('display', 'none'); } $(document).one("click", function() { objDiv.hide(); }); e.stopPropagation(); }); $(".lnkSelect p").next('ul').on("click", function(e) { e.stopPropagation(); }); }); //设为首页 function SetHome(obj, vrl) { try { obj.style.behavior = 'url(#default#homepage)'; obj.setHomePage(vrl); } catch (e) { if (window.netscape) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。"); } var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage', vrl); } } } //收藏本站 function addFavorite(obj, opts) { var _t, _u; if (typeof opts != 'object') { _t = document.title; _u = location.href; } else { _t = opts.title || document.title; _u = opts.url || location.href; } try { window.external.addFavorite(_u, _t); } catch (e) { if (window.sidebar) { obj.href = _u; obj.title = _t; obj.rel = 'sidebar'; } else { alert("您所使用的浏览器无法完成此操作。\n\n加入收藏失败,请使用Ctrl+D进行添加"); } } } // function AddFavorite(url, title) { // try { // if (document.all) { // window.external.AddFavorite(url, title); // } else if (window.sidebar && window.sidebar.addPanel) { // window.sidebar.addPanel(title, url, ""); // } else if (window.external) { // window.external.AddFavorite(url, title); // } else if (window.opera && window.print) { // return true; // } // } catch (e) { // alert("您所使用的浏览器无法完成此操作。\n\n加入收藏失败,请使用Ctrl+D进行添加"); // } // }; //保存到桌面 function toDesktop(sUrl, sName) { try { var WshShell = new ActiveXObject("WScript.Shell"); var oUrlLink = WshShell.CreateShortcut(WshShell.SpecialFolders("Desktop") + "\\" + sName + ".url"); oUrlLink.TargetPath = sUrl; oUrlLink.Save(); } catch (e) { alert("当前IE安全级别不允许操作!"); } }