//元素滚动监听 添加动画 (function ($) { $.fn.elRoll = function (options) { var param = $.extend({ anima: "ani-anima", site: 0.85 }, options, {}); var arry = []; $(this).each(function () { var that = $(this); var site = param.site; var ani = that.attr(param.anima); var data = { obj: that, anima: ani, site: site }; arry.push(data); }); function runAnima() { $.each(arry, function (i, data) { var obj = data.obj, site = data.site, anima = data.anima; if (obj) { var winH = $(window).height(), sTop = $(document).scrollTop(), grow = winH * site, eTop = obj.offset().top, post = sTop + grow; if (eTop < post) { obj.addClass(anima); }; }; }); }; runAnima(); $(window).on('scroll', function () { runAnima() }); } })(window.jQuery); //列表滑动 (function ($) { $.fn.slideRun = function (options) { var setup = $.extend({ start: 0, //起始位置 visible: 6, //可视个数 itemMobile: [768, 2], //自适应 autoplay: false, //自动滚动 speed: 500, //滑动速度 btnPrev: ".let-prev", //上一个按钮 btnNext: ".let-next", //下一个按钮 between: 10, //间距,即是margin-right的值 }, options || {}); return this.each(function () { var that = $(this); var $ul = that.find(".ul-wrapper"), $li = that.find(".li-slide"), leg = $li.length; var visual = setup.visible, speed = setup.speed, index = setup.start, marger = setup.between, isAuto = setup.autoplay; var winWidth = $(window).width(); var count = 0; var boxw = that.width(), liw = Math.round((boxw - (visual - 1) * marger) / (visual)); if (winWidth <= setup.itemMobile[0]) { visual = setup.itemMobile[1]; } else { visual = setup.visible; } $li.eq(0).addClass("active"); //设置css、设置ul,li的宽度 function setCss() { winWidth = $(window).width(); boxw = that.width(); if (winWidth <= setup.itemMobile[0]) { visual = setup.itemMobile[1]; } else { visual = setup.visible; } liw = Math.round((boxw - (visual - 1) * marger) / (visual)); $li.css({ width: liw, marginRight: marger }).eq(0).addClass("active"); $ul.css({ width: (liw + marger) * leg }); }; setCss(); $(window).on("resize", function () { setCss(); }); //向左按钮 function prevRun() { //滚动计量 index--; index = index < 0 ? 0 : index; // li 却换当前选中 count--; count = count < 0 ? 0 : count; }; //向右按钮 function nextRun() { //滚动计量 index++; index = index > leg - visual ? leg - visual : index; // li 却换当前选中 count++; count = count > leg - 1 ? leg - 1 : count; }; //执行滑动 function runing() { var sum = index * (liw + marger); $ul.stop().animate({ 'margin-left': -sum }, speed); $li.eq(count).addClass("active").siblings().removeClass("active"); }; //手势滑动或者鼠标拖动 var touchsEvent = function ($element) { var child = $ul; var sx, sy, dx, dy, mx, my, fx, mv, boxLeft, flag = false; var wrapWidth = $element.width(), wrapHeight = $element.height(); function evenStart(e) { var touchs; if (e.type == "touchstart") { touchs = e.originalEvent.targetTouches[0]; } else { touchs = e; }; sx = touchs.pageX; sy = touchs.pageY; boxLeft = $element.offset().left; mx = child.offset().left - boxLeft; flag = true; }; function evenMove(event) { event.preventDefault(); var touchs; if (flag) { if (event.type == "touchmove") { touchs = event.originalEvent.targetTouches[0]; } else { touchs = event; } dx = touchs.pageX - sx; dy = touchs.pageY - sy; mv = dx * 0.5 + mx; if (dx <= -30 && Math.abs(dy) >= 0) { fx = "left"; } if (dx >= 30 && Math.abs(dy) >= 0) { fx = "right"; }; child.css({ 'margin-left': mv }); $element.find("a").attr("onclick", "return false"); //防止拖动时a标签跳转链接 $(document).on("touchend mouseup", evenEnd); }; return false; }; function evenEnd(e) { if (fx == "left") { nextRun(); runing() } if (fx == "right") { prevRun(); runing() }; //拖动结束时恢复a标签跳转链接 setTimeout(function () { $element.find("a").removeAttr("onclick") }, 350); sx = null; sy = null; fx = null; flag = false; }; $(document).on("touchend mouseup", evenEnd); $element.on("mousedown touchstart", evenStart).on("mousemove touchmove", evenMove).on("mouseup touchend", evenEnd); $(window).on("touchend mouseup", evenEnd); }; if (leg > visual) { $(setup.btnPrev).on("click", function () { prevRun(); runing(); }); $(setup.btnNext).on("click", function () { nextRun(); runing(); }); touchsEvent(that); } else { $(setup.btnPrev).hide(); $(setup.btnNext).hide(); }; }) } })(jQuery); //用百分比来定位 (function ($) { $.fn.placeBox = function (options) { var parmas = $.extend({ boxClass: ".point", boxWidth: 1420, boxHeight: 848 }, options, {}); return this.each(function () { //data-site="100,100" left,top var that = $(this); var site = new Array(); var plac = new Array(); var posit = []; var ratio = parmas.boxHeight / parmas.boxWidth; //原图片的高宽比 function runs() { var boxW = that.width(); var boxH = Math.round(boxW * ratio); var boxL = 0, boxT = 0; var pw = boxW / parmas.boxWidth; var ph = boxH / parmas.boxHeight; $(parmas.boxClass).each(function (n) { var index = n; var self = $(this); site = $(this).attr("data-point"); plac = site.split(","); posit[n] = plac; if (site == "" || site == undefined || site == null) { plac[0] = 0; plac[1] = 0; }; boxL = Math.round((plac[1] * pw)) + "px"; //图片的位置left的值 boxT = Math.round((plac[0] * ph)) + "px"; //图片的位置top的值 $(this).css({ left: boxL, top: boxT }); self.find(".city").hover(function () { var city = $(this).attr("data-city"); $(".shcool-list-main li").find(".text").mCustomScrollbar("destroy"); $(".shcool-list-main li[data-city=" + city + "]").show().siblings().hide(); $(".shcool-list-main li[data-city=" + city + "]").find(".text").mCustomScrollbar(); }); }); }; runs(); $(window).resize(function () { runs(); }) }) } })(jQuery); //方法 var mothod = { init: function () { var that = this; that.inoutFocus(); }, homePage: function () { //首页 var leg = $("#banner-swiper .swiper-slide").length; if (leg > 1) { var banner = new Swiper("#banner-swiper", { autoplay: 5000, speed: 800, loop: true, pagination: ".swiper-pagina", paginationClickable: true, onInit: function (swiper) { //alert(swiper.activeIndex);提示Swiper的当前索引 }, onTransitionStart: function (swiper) { } }) } }, aboutPage: function () { //关于新澳门新葡萄娱乐 var that = this; $(".cultab").each(function () { var tabmain = $(this).find(".tabmain"); var tabnav = $(this).find(".tabnav"); tabnav.find("li").on("click", function () { var index = tabnav.find("li").index(this); $(this).addClass("active").siblings().removeClass("active"); showTime(index); }).eq(0).trigger("click"); function showTime(on) { tabmain.find("li").eq(on).show().siblings().hide() } }); }, businessPage: function () { //集团业务 var that = this; var dait = new Swiper("#dait-swiper", { autoplay: 5500, speed: 800, loop: false, pagination: ".swiper-pagina", paginationClickable: true, onInit: function (swiper) { //alert(swiper.activeIndex);提示Swiper的当前索引 lishow(0); $(".linkbar a").eq(0).addClass("active").siblings().removeClass("active"); }, onTransitionStart: function (swiper) { var index = swiper.activeIndex; $(".linkbar a").eq(swiper.activeIndex).addClass("active").siblings().removeClass("active"); lishow(swiper.activeIndex); } }); $(".linkbar a").on("mouseenter", function () { var count = $(this).index(); $(this).addClass("active").siblings().removeClass("active"); lishow(count); dait.slideTo(count, 800, false); }); function lishow(n) { $(".title li").eq(n).show().siblings().hide() } var views = 3; var mar = 25; var wind = $(window).width(); if (wind < 980) { views = 2; mar = 10; } else { views = 3; mar = 25; } var item = new Swiper("#item-swiper", { autoplay: false, speed: 500, loop: false, slidesPerView: views, slidesPerGroup: views, spaceBetween: mar, onTransitionStart: function (swiper) { //alert(swiper.activeIndex) } }); $(".btn-prev").click(function () { item.slidePrev() }) $(".btn-next").click(function () { item.slideNext() }); var real = new Swiper("#real-swiper", { autoplay: false, speed: 500, loop: false, slidesPerView: views, slidesPerGroup: views, spaceBetween: mar, onTransitionStart: function (swiper) { //alert(swiper.activeIndex) } }); $(".btn-left").click(function () { real.slidePrev() }) $(".btn-right").click(function () { real.slideNext() }); var ablue = new Swiper("#show-swiper", { autoplay: false, speed: 500, loop: false, slidesPerView: 4, slidesPerGroup: 4, spaceBetween: 27, onTransitionStart: function (swiper) { //alert(swiper.activeIndex) } }); $(".slide-box").each(function () { var _this = $(this); var inner_swiper = new Swiper("#inner-swiper", { autoplay: false, speed: 500, loop: false, slidesPerView: 1, slidesPerGroup: 1, spaceBetween: 1, onTransitionStart: function (swiper) { //alert(swiper.activeIndex) } }); $(".ary-prev", _this).click(function () { inner_swiper.slidePrev() }) $(".ary-next", _this).click(function () { inner_swiper.slideNext() }); }); }, relatePage: function () { //投资者关系 var year_swiper = new Swiper("#year-swiper", { slidesPerView: "auto", slidesPerGroup: 1, spaceBetween: 0 }); }, videoPlay: function (s,p) { //视频播放 var videoHtml = "