/*! Project : 澳门蒙特卡罗app +---------common.js----------+ | | | Author | yeshiqiu | | Q__Q | 337676937 | | Addr | SC_Chengdu | | Date | 2019.09.28 | | | +--!-_-!--------------!-_-!--+ */ $b=$("body"); w.Y_LazyLoad(); // 顶部切换Class ;(function($){ $('.index-banner,.subpage-banner').after($('.TopLine')); var setNav = function(dur){ // if($(".mc-Main").length) {return;} var bFlag=w.scrollTop()>($(".TopLine").length?$(".TopLine").offset().top - $('.header').outerHeight() :1); // if($(".subpage").length){bFlag=!0;} if(dur!=undefined){$(".nav .bg").Y_SetCss3({dur:"0ms"}); setTimeout(function(){$(".nav .bg").removeAttr('style'); },1); } bFlag?$(ysq.wrap).addClass('fixedNav'):$(ysq.wrap).removeClass('fixedNav'); }; setTimeout(function(){ w.on("scroll.navC",function(){setNav();}); setNav(0); },1); })(jQuery); // setSubPage ;(function($){ setMinHeight($(".subpage")); setMinHeight($(".index")); function setMinHeight($e) { if(!$e.length)return; var $TL=$(".TopLine"),$BL=$(".BottomLine"); $e.css("min-height",function(){return $(this).css("min-height")||0;}); if($(ysq.wrap).outerHeight()'+ 'X'+ '' ); $('[data-videoSrc]').click(function(event) { // $('[data-videoSrc]').each(function(i,oVideo) { // $(oVideo) // }); // var src=$(this).attr("data-videoSrc"); // var $modalPlayer=$(".modal-videoPlayer"); // $modalPlayer.find('.player').remove(); // $modalPlayer.append($('')); // setTimeout(function(){ // $modalPlayer.Y_Modal(); // },1); //iframe var src=$(this).attr("data-videoSrc"); $(".modal-videoPlayer").append($('
')) .fadeIn(300,function(){ var $videoPlayer=$(this); $videoPlayer.find('.close').one('click', function(event) { $videoPlayer.fadeOut(function(){$(this).find('.contain').remove();}); }); }); }); })(jQuery); // ;(function($){ var $viewport=$('.subpage-nav'),X=0.5, //0.5居中 0居左 // $viewport=$('.viewport',$this), $overview=$(".overview",$viewport), $itemOn=$('.link.on',$viewport); if($itemOn.length/*&&$overview.outerWidth()>$viewport.outerWidth()*/){ $viewport.scrollLeft($itemOn.offset().left+$viewport.scrollLeft()-($viewport.offset().left)+($itemOn.outerWidth()-$viewport.outerWidth())*X); } })(jQuery); // ;(function($){ $('.sHonor-tab').Y_Tab({initNum:$('.sHonor-tab .Tg .btn').length-1, event:"mouseenter",clickMoveTg:[!0,"h","scroll"],fn:{ start:function($this,idx,$TtC,$TgC,$Ta){ $TtC.find('.txt p').mouseenter(function(event) { var $pic=$(this).parents(".box").find('.pic'); $pic.find('img').attr({"src":"/public/images/g.png","lazy-src":$(this).attr("data-src")}); fnLazyloadPd($pic)&&$.fn.Y_LazyLoad.Init($pic,!0); }); } }}); })(jQuery); jQuery(document).ready(function($) { // baset-Resize w.on("resize.baset",function(e) { ysq.TT && $("title").html(window.innerWidth); clearTimeout(this.resizeTimer); if (window.innerWidth>Global.resWidth) { Global.device = "pc"; // 首屏banner // if(920/1920*w.width()>w.height()-$(".header").outerHeight()){ // $(".banner").css({paddingBottom:(w.height()-$(".header").outerHeight())/w.width()*100+"%"}); // } //bg set // $(".suitableBg").length && fullsetImg($(".suitableBg"), 1920, Global.DesignHeight); } else { Global.device = "wap"; } //bg set setTimeout(function() { ysq.FzAuto(); // $(".suitableBg").each(function(i, oE) { // $(oE).css({height: "100%", width: "auto"}); // if($(oE).width()<=w.width()){ // $(oE).css({width: "100%", height: "auto", top: "50%", marginTop:-$(oE).height()/2,left:0,marginLeft:0 }); // }else{ // $(oE).css({left: "50%", marginLeft:-$(oE).width()/2,top:0,marginTop:0 }); // } // }); // $(".resImg").each(function(i,oE) { $(oE).attr("src",function(e,a){ var _src=''; $.each($(oE).attr("data-src").split("|"),function(i,data) { data=data.split(","); if(w.width()<=data[0]){_src=data[1]; } }); return _src; }); }); }, 1); // var _device=Global.device; // if(!MinWidth(750)){_device="mini";} // $(".sec_bg img").each(function(i,e) { // $(e).attr({"src":$(e).attr(Global.device+"-src")}) // }); // $(".res-img").css({paddingBottom:$(".sban").attr(_device+"-pad")}); if (w.data("device_status") != Global.device) { if (Global.device == "pc") { $h.addClass(Global.device).removeClass('wap'); $(".header").removeClass('navshow').find(".subnav").hide(); } else if (Global.device == "wap") { $h.addClass(Global.device).removeClass('pc'); } w.data("device_status", Global.device); } this.resizeTimer = setTimeout(function(){ w.trigger('scroll'); },100); }).trigger('resize.baset'); // 导航 ;(function($) { var baseY=0; // w.on("scroll.fixNav",function(eve) { // if(w.scrollTop()>=1$(".TopLine").offset().top-$(".header").height()){$(ysq.wrap).addClass('fixNav');} // else {$(ysq.wrap).removeClass('fixNav');} // }); var $navBg=$(".header .bg"),$firNav = $(".header .firNav"),$secNav = $(".header .secNav"); $(".navbtn").click(function(e) { var $this=$(this), $initItem=$firNav.find('.secNav .secItem.on'); // fnScrollElePd($(".header"))&&$.fn.Y_ScrollEle.Init($(".header"))&&$.fn.Y_ScrollEle.Do($(".header"),0,!0); if($b.hasClass('navShow')){ $b.removeClass('navShow'); // $navBg.fadeOut(); // $firNav.css({right: "-100%"}); }else{ $b.addClass('navShow'); // $navBg.fadeIn(); // $initItem.length&&$initItem.parents(".secNav").show(); // $firNav.css({"right": "0%"}); } }); $navBg.click(function(event) { $b.removeClass('navShow'); // $navBg.fadeOut(); // $firNav.css({right: "-100%"}); }); // w.on("resize.nav",function(event) { $firNav.find('.firItem').off("mouseleave.nav").off("mouseenter.nav").off("click.nav"); if(Global.device == "pc"){ // reset-Pc $(".navbtn").removeClass('navShow'); // $navBg.fadeOut(); $firNav.add($secNav).removeAttr('style'); // $firNav.find('.firItem').on("mouseenter.nav",function(eve) { $(this).siblings().find('.secNav').slideUp().removeClass("active"); $(this).find('.secNav').stop(!0,!0).slideDown().addClass("active"); }).on("mouseleave.nav",function(event) { $(this).find('.secNav').stop(!0,!1).slideUp().removeClass("active"); }); }else{ $firNav.find('.firItem').on("click.nav",function(eve) { var $this=$(this); if($this.find('.secNav').length){ if($this.find('.secNav').is(':hidden')){ $this.siblings(".firItem").removeClass("on").find('.secNav').hide(0); $this.addClass("on").find('.secNav').show(0); return prevent_default(eve); } } }); } }).trigger('resize.nav'); })(jQuery); $('.sCourse-list').Y_NavSlideBlock({vertical:!0,fn:{ before:function($this){ // w.on('resize.getSwitch', function(event) { // $this[0].switch=Global.device=='pc'; // }).trigger('resize.getSwitch'); } }}); // subNav ;(function($){ var $subNav=$(".subNav"), $viewport=$(".viewport",$subNav), $overview=$(".overview",$subNav), // $subItem=$('.link',$subNav), $linkOn=$('.link.on',$subNav); if($overview.outerWidth()>$viewport.outerWidth()){ $linkOn.length&&$viewport.scrollLeft($linkOn.offset().left+$viewport.scrollLeft()-($viewport.offset().left)+$linkOn.outerWidth()/2-$viewport.outerWidth()/2); // $subNav.Y_DragScroll(); } // var $subNav=$(".subNav"), // $firNav=$subNav.find('.firNav'),$firItem=$firNav.find('.firItem'), // $secNav=$subNav.find('.secNav'),$secItem=$secNav.find('.secItem'); // if(!$subNav.length){return;} // w.on("resize.subNav",function(event) { // $firItem.off("mouseleave.subNav").off("mouseenter.subNav").off("click.subNav"); // var $baseOn=$(".subNav .firItem.on"); // if(Global.device == "pc"){ // $secItem.removeClass('on'); // $firItem.add($secItem).on("mouseenter.subNav",function(eve) { // // $(this).siblings().find('.secNav').slideUp(300); // // $(this).find('.secNav').stop(!0,!0).slideDown(500); // $secNav.show(); // onoff($(this)); // onoff($secItem.eq($(this).index())); // }).on("mouseleave.subNav",function(event) { // $secNav.hide(); // $secItem.removeClass('on'); // onoff($baseOn); // // $(this).find('.secNav').stop(!0,!1).slideUp(200); // }); // }else{ // $secItem.removeClass('on'); // $firItem.on("click.subNav",function(eve) { // if($secItem.eq($(this).index()).hasClass('on')){ // $secNav.hide(); // $secItem.removeClass('on'); // }else { // $secNav.show(); // onoff($(this)); // onoff($secItem.eq($(this).index())); // } // if($secItem.eq($(this).index()).children().length>0){return prevent_default(eve);} // }); // } // if($firItem.width()*$firItem.length>$firNav.offset().left+$firNav.width()){ // $subNav.addClass('scrollX').children('.arrow').length||$subNav.append($("
",{class:"arrow"})); // $subNav.each(function(i,oE) { // var $scBox=$(".firNav",$(oE)),$linkOn=$(".firItem.on",$scBox); // if(!$scBox.length){return;} // $(oE).Y_OffsetMove({Tt:".firNav",TtC:".firItem",next:".arrow",single:!1}); // $scBox.length&&$linkOn.length&&($scBox.scrollLeft($linkOn.offset().left-$scBox.offset().left)); // }); // }else{ $subNav.removeClass('scrollX').children('.arrow').remove();} // }).trigger('resize.subNav'); })(jQuery); // 人才 ;(function($){ $(".sRecruit-list").delegate('.show', 'click', function(event) { var $item=$(this).parents(".item"), $btn=$(this).find('.btn span'); if($btn.length){ $btn.text()=="展开全部信息"?$btn.text("收起全部信息"):$btn.text("展开全部信息");} if(!$item.hasClass('unfold')){ $item.addClass('unfold').find('.hide').slideDown(200)//.parents(".item").siblings('.item').removeClass("unfold").find('.hide').slideUp(200); }else{ $item.removeClass('unfold').find('.hide').slideUp(200); } }); })(jQuery); // ajax滚动翻页 // ;(function($) { var oList="#ajaxList"; if(!$(oList).length){return;} var bAllowed=!0,bTitleChange=!1,bScrollAjax=!1,bDivisional=!1,bEmpty=!1,bPushState=!1, nowPageNum=parseInt($(oList).attr("pageNum"))||1,baseTime=0,baseDelay=500; var tipWords={do:"MORE+",ing:"加载中",done:"已加载全部",redo:"请点击重试",timeout:"请求超时,请点击重试"}; /*ajax翻页*/ Global.ajaxPaging = function (url,bNotPush) { if($("#loadState").hasClass('off'))return; bAllowed&&$.ajax({ url: url, type: 'POST', dataType: 'HTML', timeout: 5E3, beforeSend: function() { var allowed=!!bNotPush; Global.setState(allowed,tipWords.ing,1); baseTime=new Date().getTime(); (bEmpty&&!bScrollAjax)&&Y_BodyScroll({dis:$(oList).offset().top}); }, success: function(data, Status, xhr) { var delay=baseDelay-(new Date().getTime()-baseTime); setTimeout(function(){ if (!$(data).find(oList).children(".item").length) { Global.setState(!1,tipWords.done,2); } else { nowPageNum=Number(url.match(/\d+/)[0]); $(oList).attr("pageNum",nowPageNum); /*分隔*/ bDivisional&&$(oList).append($(oList).children(".item").eq(0).clone().removeClass().addClass("hrLine").html("Page:"+nowPageNum)); /*清空列表*/ (bEmpty&&!bScrollAjax)&&$(oList).empty(); /*数据添加*/ $(oList).find(".warn").remove(); $(oList).append($(data).find(oList).html()); /*回调函数处理*/ fnScrollElePd($(oList))&&($.fn.Y_ScrollEle.Init($(oList)),$.fn.Y_ScrollEle.Do($(oList),0,!0)); fnLazyloadPd($(oList))&&$.fn.Y_LazyLoad.Init($(oList)); setTextLine($("[data-text-line]",$(oList))); isNull($(oList).data("callback"))||$(oList).data("callback")(); /*新添加数据是否达到分页*/ if($(oList).children(".item").length%($(oList).attr('pageSize')||8)==0){ Global.setState(!0,tipWords.do,3); }else{Global.setState(!1,tipWords.done,2);} /*设置当前页标题*/ bTitleChange&&(document.title=data.slice(data.indexOf('澳门蒙特卡罗app-Welcome Home")).replace('', '')); /*H5_pushState*/ bPushState&&(!!bNotPush||(history.pushState&&history.pushState({page:url}, '', url))); } },delay<1?1:delay); }, error: function(xhr, textStatus, errorThrown) { var delay=baseDelay-(new Date().getTime()-baseTime); setTimeout(function(){ if (errorThrown == "Not Found") { Global.setState(!1,tipWords.done,2); } else if(errorThrown == "timeout") { Global.setState(!0,tipWords.timeout,3); } else { Global.setState(!0,tipWords.redo,3); } },delay<1?1:delay); } }); }, /*ajax返回值状态判定*/ Global.setState = function (bFlag,words,type){ var _sNextPage=$("#loadState").attr("nextPage"); switch(type){ case 1: $("#loadState").attr("class","ing");break; case 2: $("#loadState").attr("class","off").removeAttr("nextPage").off("click.retry");break; case 3: $("#loadState").attr("class","retry").attr("nextPage",_sNextPage.replace(getLastNum(_sNextPage), $(oList).attr("pageNum")/1+1 ));break; default: ysq.TT&&cw("使用方法错误"); } bAllowed=bFlag; $("#loadState").text(words); }; /*按钮基础状态设置*/ $("#loadState").length||$(oList).after('<div id="loadState" class="retry" nextPage="index_'+(nowPageNum+1)+'.html">查看更多 +</div>'); w.load(function() { if($(oList).children(".item").length<parseInt($(oList).attr('pageSize')||8)){ $(oList).children(".item").length?Global.setState(!1,tipWords.done,2):Global.setState(!1,"暂无",2); }else if($(oList).children(".item").length>parseInt($(oList).attr('pageSize')||8)){ a("目前列表分页个数为:"+(parseInt($(oList).attr('pageSize')||8))+" !\n已超出,请重新设置分页个数。"); Global.setState(!0,"分页设置出错,请重新设置。",3); }else{Global.setState(!0,tipWords.do,3);} /*页码点击绑定*/ $b.delegate("#loadState",TouchEd,function(event){Global.ajaxPaging($(this).attr("nextPage")); }); /*滚动加载启动*/ bScrollAjax&&w.scroll(function(){bAllowed&&inWindow($("#loadState"))&&Global.ajaxPaging($("#loadState").attr("nextPage"));}); /*popState监听*/ // ('onpopstate' in window)&&window.addEventListener("popstate", function(stateEve) { bScrollAjax||Global.ajaxPaging(location.href.match(/[^\/]+$/)[0],!0); }); }); })(jQuery); function getLastNum($e){var num=$e.match(/\d+/ig, function(result){return result;});num=num[num.length-1];return num/1; } });