//菜单栏移入效果 $(function () { $(".public_nav>ul>li").hover(function () { if ($(this).hasClass("current_page")) { } else { $(this).find('span').stop(true, true).animate({ width: "100%" }, 200); } }, function () { if ($(this).hasClass("current_page")) { } else { $(this).find('span').stop(true, true).animate({ width: "0px" }, 200); } }); }) // 头部登录状态下 个人中心弹窗 $(".user_popup").hover(function () { $(".land_popup").show(); }, function () { $(".land_popup").hide(); }); // 去掉ie浏览器 回车键 默认效果 document.onkeydown = function (e) { var e = e || event; if (e.keyCode == 13) { e.preventDefault ? e.preventDefault() : (e.returnValue = false); } } //回到顶部 $(function () { //检测屏幕高度 var height = $(window).height(); height = 3 / 4 * height; //scroll() 方法为滚动事件 $(window).scroll(function () { if ($(window).scrollTop() > height) { $(".hide_top").fadeIn(500); } else { $(".hide_top").fadeOut(500); } }); }); $(".warp_ctlist .totop").click(function () { $("html,body").animate({ scrollTop: '0px' }, 500); }); // 底部弹窗 $(".ad_bottom .close").click(function () { $(".ad_bottom").hide(); $(".footer ul").css("cssText", " padding: 35px 0 !important; "); }); // setTimeout(function () { // if ($(".ad_bottom img").length > 0) { // if ($(".ad_bottom").css("display") == 'none') { // $(".footer ul").css("cssText", " padding: 35px 0 !important;"); // } else { // $(".footer ul").css("cssText", " padding: 35px 0 153px 0 !important;"); // } // } else { // $(".footer ul").css("cssText", " padding: 35px 0 !important;"); // } // }, 1000); // 下载弹窗 $(".az_code img").hover(function () { $(".download_popup .big_az_code").css("cssText", "display: block !important"); }, function () { $(".download_popup .big_az_code").css("cssText", "display: none !important"); }); $(".download_popup .close").click(function () { $(".warp_download_popup").hide(); }); $(".download").click(function () { $(".warp_download_popup").show(); }); $(".tip .close,.determine,.cancel").click(function () { $(".warp_no_download_popup").hide(); $(".warp_kf_popup").hide(); }); $(".no_download").click(function () { $(".warp_no_download_popup").show(); }); // 下载弹窗 $(".small-code").hover(function () { $(this).next().show(); // $(".az_code_right .big_az_code").show(); }, function () { $(this).next().hide(); // $(".az_code_right .big_az_code").hide(); }); $(".rollBox").hover(function () { $(".manu_phone_left").show(); $(".manu_phone_right").show(); }, function () { $(".manu_phone_left").hide(); $(".manu_phone_right").hide(); }); $(".az_hover").hover(function () { $(".az_hover img").attr("src", "/static/images/home/az-white.png"); $(".az_hover span").css("cssText", "color:#fff !important"); }, function () { $(".az_hover img").attr("src", "/static/images/home/SVG-07.png"); $(".az_hover span").css("cssText", "color: #8cc63d !important"); }); // 手游排行控件显示隐藏 $(function () { $('.rank_list>div').eq(0).find('.big').show() $('.rank_list>div').eq(0).find('.small').hide() $('.rank_list').hover(function () { $('.rank_list>div').hover(function () { $(this).find('.big').show().parent().siblings().find('.big').hide(); $(this).find('.small').hide().parent().siblings().find('.small').show(); }); }); }) // 右侧广告 // 最下方两张图片 $(function () { $('.article_adv').hover(function () { $('.article_adv div').stop(true, false).animate({ bottom: 0 }) }, function () { $('.article_adv div').stop(true, false).animate({ bottom: '-28px' }) }); }) // 底部广告关闭不显示 //今日不再显示 $(".ad_bottom .close").click(function () { //当前日期 var curDate = new Date(); //当前时间戳 var curTamp = curDate.getTime(); //当日凌晨的时间戳,减去一毫秒是为了防止后续得到的时间不会达到00:00:00的状态 var curWeeHours = new Date(curDate.toLocaleDateString().replace(/(年|月)/g, '/').replace('日', '').replace(/[^\d-/]/g, '')).getTime() - 1; //当日已经过去的时间(毫秒) var passedTamp = curTamp - curWeeHours; //当日剩余时间 var leftTamp = 24 * 60 * 60 * 1000 - passedTamp; var leftTime = new Date(); leftTime.setTime(leftTamp + curTamp); // 设置cookie document.cookie = 'loginCounta=1;expires=' + leftTime.toGMTString() + ';path=/'; // $("#advert_laye").css("display", "none") }) $(document).ready(function () { var isClosed = /(^|;| )loginCounta=1/.test(document.cookie); //判定cookie是否存在 if (!isClosed) { $(".ad_bottom").css("display", "block") } else { $(".ad_bottom").css("display", "none") } }); // 进度条 $(".gift_surplus").each(function () { var b = $(this).width(); var a = $(this).parent(".warp_gift_surplus").width(); if (a == b) { $(this).css("border-radius", "8px") } }) //延迟加载图片 $(function () { var visible; $('img').each(function () { visible = $(this).offset().top - $(window).scrollTop(); if ((visible > 0) && (visible < $(window).height())) { visible = true; } else { visible = false; } if (visible) { $(this).attr('src', $(this).attr('lazy-src')); } }); $(window).scroll(function () { $('img').each(function () { if ('/static/images/icon/990-625.png' == $(this).attr('src') || '/static/images/icon/150-150.png' == $(this).attr('src') || '/static/images/icon/625-990.png' == $(this).attr('src') || '/static/images/icon/1200-200.png' == $(this).attr('src') || '/static/images/icon/1200-625.png' == $(this).attr('src')) { visible = $(this).offset().top - $(window).scrollTop(); if ((visible > 0) && (visible < $(window).height())) { visible = true; } else { visible = false; } if (visible) { $(this).attr('src', $(this).attr('lazy-src')); } } }); }); }); //右侧控件 $(".customer_service ul,.warp_right.warp_qq_icon,.warp_ctlist .qq,.warp_qq").hover(function () { $(".customer_service").show(); $(".warp_qq").stop(true, false).animate({ 'margin-top': '-58px' }, 160) }, function () { $(".customer_service").hide(); $(".warp_qq").stop(true, false).animate({ 'margin-top': '0px' }, 160) }); $(".warp_ctlist .weixin,.warp_right.warp_code,.ctlist .code,.warp_weixin").hover(function () { $(".ctlist .code").show(); $(".warp_weixin").stop(true, false).animate({ 'margin-top': '-58px' }, 160) }, function () { $(".ctlist .code").hide(); $(".warp_weixin").stop(true, false).animate({ 'margin-top': '0px' }, 160) }); $(".customer_service li:first-child+li").hover(function () { $(".border-right-empty span").css("border-left", "10px solid #51a7ff") }, function () { $(".border-right-empty span").css("border-left", "10px solid #f6f6f6") }); $('.warp_totop,.warp_feedback').hover(function () { $(this).stop(true, false).animate({ 'margin-top': '-58px' }, 160) }, function () { $(this).stop(true, false).animate({ 'margin-top': '0px' }, 160) }); $(".qq_1").hover(function () { $(this).find("img").attr("src", "/static/images/home/SVG-16.png"); }, function () { $(this).find("img").attr("src", "/static/images/home/SVG-09.png"); }); // 点击调用方法,弹出对话框 $(".customer_service li").on("click", "a", function () { openQQ($(this).attr("data-QQ")); }) // 打开对话框的方法 function openQQ(qq) { window.location.href = "tencent://message/?uin=" + qq + "&Site=&Menu=yes"; } // 设置默认游戏icon $(".smallIcon").error(function () { $(this).attr("src", "/static/images/icon/150-150.png"); }) // 分页 $(function () { $(".pagination li:first-child a").html('上一页'); $(".pagination li:first-child span").html('上一页'); $(".pagination li:last-child a").html('下一页'); $(".pagination li:last-child span").html('下一页'); }); $(".disabled").each(function(){ var a = $(this).text(); if(a="..."){ //修改父元素 $(this).find("span").css("cssText", "background:#fff;color:#494949 !important;border:none;cursor: context-menu;"); } }) // 退出登录 function toExit() { $.ajax({ type: 'POST', url: '/member/logout', data: {}, dataType: 'json', success: function (json) { window.location.reload(); }, error: function () { alert('网络错误,请刷新页面重试'); } }); } // 搜索框 $('body').bind('click', function (event) { // IE支持 event.srcElement , FF支持 event.target var evt = event.srcElement ? event.srcElement : event.target; if (evt.id == 'search-input'|| evt.id == 'delete') { var a = $('#search-input').val(); if (a == "") { // $("#search_ul").hide(); update_history(); } else if ($("#search_ul li").length > 0) { $("#search_ul").show(); } } else { $('#search ul ').hide(); // 如不是则隐藏元素 } }); $("#search_result").click(function () { var vala = $("#search-input").val(); if (vala == "") { vala = $("#search-input").attr('placeholder'); $("#search_ul").hide(); } else if ($("#search_ul li").length > 0) { $("#search_ul").show(); } var search = "/search/keyword/" + vala; $("#search_result").attr("href", search); }) // 去掉ie回车键默认作用 document.onkeydown = function (e) { var e = e || event; if (e.keyCode == 13) { e.preventDefault ? e.preventDefault() : (e.returnValue = false); } } var flag = true; $('#search-input').on('compositionstart', function () { flag = false; }) $('#search-input').on('compositionend', function () { flag = true; }) var search = { searchKeyword: function () { val = String($('#search-input').val()) val = val.replace(/\s*/g, ""); vala = $('#search-input').val(); if (vala == "") { vala = $("#search-input").attr('placeholder'); // $("#search_ul").hide(); update_history(); } else if ($("#search_ul li").length > 0) { $("#search_ul").show(); } var search = "/search/keyword/" + vala; $("#search_result").attr("href", search); // 按回车搜索 var e = event || window.event || arguments.callee.caller.arguments[0]; if (e && e.keyCode == 13) { // enter 键 document.getElementById("search_result").click(); } setTimeout(function () { if (flag) { if (!val.length || val.length == 0 || vala == " ") { // $("#search_ul").hide(); // $("#search_ul").empty(); update_history(); return } $.ajax({ type: 'POST', url: '/game/ajaxGameList', dataType: 'json', data: { keyword: val }, success: function (json) { if ($.isEmptyObject(json)) { $("#search_ul").empty(); $("#search_ul").hide(); } else { var html = '', turl = '/game101'; $.each(json, function (i, row) { toUrl = turl.replace('101', row.id) html += '