| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- //广告弹出层
- //点击关闭
- $('.adpop').hover(function () {
- $(this).find('.closed').stop(true, true).fadeIn('normal');
- }, function () {
- $(this).find('.closed').stop(true, true).fadeOut('normal');
- });
- $('.adpop .closed').click(function () {
- $(this).parents('.adpop').hide();
- });
- $(document).ready(function () {
- setTimeout(function () {
- $('.adpop').fadeOut(1000);
- }, 5000);
- });
- // 鼠标滑过不消失
- $('.adpop').hover(function () {
- if ($(".adpop").css("opacity") == 1) {
- $('.adpop').stop(true, false).fadeOut(3000, 1);
- }
- }, function () {
- $('.adpop').stop(true, false).fadeOut(3000);
- });
- //今日不再显示
- function closeToday() {
- if ($('#box').is(':checked')) {
- //当前日期
- 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 = 'loginCount=1;expires=' + leftTime.toGMTString() + ';path=/';
- // $("#advert_laye").css("display", "none")
- }
- }
- $(document).ready(function () {
- var isClosed = /(^|;| )loginCount=1/.test(document.cookie); //判定cookie是否存在
- if (!isClosed) {
- $("#advert_laye").css("display", "block")
- } else {
- $("#advert_laye").css("display", "none")
- }
- });
- // 推荐移入效果
- $(".warp_advpic").on("mouseenter mouseleave", function (e) {
- var $bg = $(this).find('.adv_txt ');
- var w = this.offsetWidth; //获取元素宽度
- var h = this.offsetHeight; //获取元素高度
- var toTop = this.getBoundingClientRect().top + document.body.scrollTop; //兼容滚动条
- var x = e.pageX - this.getBoundingClientRect().left - w / 2; //获取当前鼠标的x轴位置(相对于这个li的中心点)
- var y = e.pageY - toTop - h / 2; ////获取当前鼠标的y轴位置(相对于这个li的中心点)
- var direction = Math.round((((Math.atan2(y, x) * 180 / Math.PI) + 180) / 90) + 3) % 4; //direction的值为“0,1,2,3”分别对应着“上,右,下,左”
- var eventType = e.type;
- var res = Math.atan2(y, x) / (Math.PI / 180) + 180;
- var dirName = new Array('上方', '右侧', '下方', '左侧');
- if (eventType == 'mouseenter') {
- // $('.advhide').text(dirName[direction] + '进入');
- animationIn(direction, $bg);
- } else {
- // $('.advhide').text(dirName[direction] + '离开');
- animationOut(direction, $bg);
- }
- });
- function animationIn(direction, ele) {
- switch (direction) {
- case 0:
- ele.css({
- left: 0,
- top: '-201%'
- }).stop(true, false).animate({
- top: 0
- }, 300);
- break;
- case 1:
- ele.css({
- left: '100%',
- top: 0
- }).stop(true, false).animate({
- left: 0
- }, 300);
- break;
- case 2:
- ele.css({
- left: 0,
- top: '201%'
- }).stop(true, false).animate({
- top: 0
- }, 300);
- break;
- case 3:
- ele.css({
- left: '-201%',
- top: 0
- }).stop(true, false).animate({
- left: 0
- }, 300);
- break;
- }
- }
- function animationOut(direction, ele) {
- switch (direction) {
- case 0:
- ele.stop(true, false).animate({
- top: '-201%'
- }, 300);
- break;
- case 1:
- ele.stop(true, false).animate({
- left: '201%'
- }, 300);
- break;
- case 2:
- ele.stop(true, false).animate({
- top: '201%'
- }, 300);
- break;
- case 3:
- ele.stop(true, false).animate({
- left: '-201%'
- }, 300);
- break;
- }
- }
- // 图标平移
- $(function () {
- $('.appraisal>h4>div').hover(function () {
- $('.appraisal>h4>div>img').stop(true, false).animate({
- 'right': '35px'
- })
- $('.appraisal>h4>div span').stop(true, false).animate({
- 'right': '0px'
- })
- }, function () {
- $('.appraisal>h4>div>img').stop(true, false).animate({
- 'right': '0px'
- })
- $('.appraisal>h4>div span').stop(true, false).animate({
- 'right': '-35px'
- })
- });
- $('.strategy>h4>div').hover(function () {
- $('.strategy>h4>div>img').stop(true, false).animate({
- 'right': '35px'
- })
- $('.strategy>h4>div span').stop(true, false).animate({
- 'right': '0px'
- })
- }, function () {
- $('.strategy>h4>div>img').stop(true, false).animate({
- 'right': '0px'
- })
- $('.strategy>h4>div span').stop(true, false).animate({
- 'right': '-35px'
- })
- });
- $('.rank>h4>div').hover(function () {
- $('.rank>h4>div>img').stop(true, false).animate({
- 'right': '35px'
- })
- $('.rank>h4>div span').stop(true, false).animate({
- 'right': '0px'
- })
- }, function () {
- $('.rank>h4>div>img').stop(true, false).animate({
- 'right': '0px'
- })
- $('.rank>h4>div span').stop(true, false).animate({
- 'right': '-35px'
- })
- });
- $('.classify>h4>div').hover(function () {
- $('.classify>h4>div>img').stop(true, false).animate({
- 'right': '35px'
- })
- $('.classify>h4>div span').stop(true, false).animate({
- 'right': '0px'
- })
- }, function () {
- $('.classify>h4>div>img').stop(true, false).animate({
- 'right': '0px'
- })
- $('.classify>h4>div span').stop(true, false).animate({
- 'right': '-35px'
- })
- });
- })
- // 开服开测
- $(function () {
- var $open_service_tab = $(".open_service_title span");
- var $open_service_contain = $('.content_list');
- var index = 0;
- $open_service_tab.hover(function () {
- $($open_service_tab[index]).removeClass('active');
- $($open_service_contain[index]).removeClass('show');
- index = $(this).index();
- $(this).addClass('active');
- $($open_service_contain[index]).addClass('show');
- });
- });
- // 游戏分类
- sth2('.classify_title>p', '.classify_content>ul');//礼包发号
- function sth2(hvObj, obj) {
- $(hvObj).hover(function () {
- var ind = $(this).index();
- $(this).addClass('active').siblings().removeClass('active');
- if ('/static/images/icon/150-150.png' == $(obj).eq(ind).find('img:first').attr('src')) {
- $this = $(obj).eq(ind).find('img').each(function () {
- $(this).attr('src', $(this).attr('lazy-src'));
- });
- }
- $(obj).eq(ind).show().siblings().hide();
- });
- }
- // 手游排行控件显示隐藏
- $(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 () {
- $('.tail_pic_one').hover(function () {
- $('.tail_pic_one a div').stop(true, false).animate({
- bottom: 0
- })
- }, function () {
- $('.tail_pic_one a div').stop(true, false).animate({
- bottom: '-28px'
- })
- });
- $('.tail_pic_two').hover(function () {
- $('.tail_pic_two a div').stop(true, false).animate({
- bottom: 0
- })
- }, function () {
- $('.tail_pic_two a div').stop(true, false).animate({
- bottom: '-28px'
- })
- })
- })
- // input placeholder ie兼容
- if (!('placeholder' in document.createElement('input'))) {
- $('input[placeholder],textarea[placeholder]').each(function () {
- var that = $(this),
- text = that.attr('placeholder');
- // console.log(text);
- if (that.val() === "") {
- that.val(text).addClass('placeholder');
- that.css("color", "#757575")
- }
- that.focus(function () {
- if (that.val() === text) {
- that.val("").removeClass('placeholder');
- }
- }).blur(function () {
- if (that.val() === "") {
- that.val(text).addClass('placeholder');
- that.css("color", "#757575")
- }
- })
- });
- }
- // 轮番图
- layui.use('carousel', function () {
- var carousel = layui.carousel;
- //建造实例
- carousel.render({
- elem: '#test1'
- , width: '100%'
- , height: '486px'
- , arrow: 'hover'
- , interval: "5000"
- , trigger: 'hover'
- });
- });
- // url生成二维码
- var qrcode = new QRCode(document.getElementById("qrcode"), {
- width: 100,
- height: 100,
- correctLevel: 0
- });
- $(".download").click(function () {
- var p_text = $(this).find("#text-1").text();
- var p_title = $(this).find("#text-2").text();
- var p_page = $(this).find("#download-page").text();
- qrcode.makeCode(p_page);
- $('.az_hover a').attr('href', p_text);
- $('.download_popup p').html(p_title);
- });
- $(function () {
- //加载 开服开测模板
- $("#J_serverinfo").load('/Layout/serverinfo');
- $("#J_rank_list").load('/Layout/gameRankList');
- $("#J_recommend_gift").load('/Layout/recommendGiftList');
- });
- // 头条新闻
|