var vhs = $("body").hasclass("infobody-on"); $(window).scroll(function(){ if($(window).scrolltop() >= $(window).innerheight()/3){ $(".backtop").show(); }else{ $(".backtop").hide(); } var wraps=$(".bocweb-header2-tip").innerheight(); var tops = ($(window).scrolltop()); if(!vhs){ if(wraps >= tops){ $(".bocweb-header2").removeclass('fixed onactive'); // $("body").removeclass("onsactive-on"); }else if(wraps <= tops){ $(".bocweb-header2").addclass('fixed onactive'); // $("body").addclass("onsactive-on"); }; }else{ if(wraps >= tops){ $(".bocweb-header2").removeclass('fixed'); }else if(wraps <= tops){ $(".bocweb-header2").addclass('fixed'); }; } if($("div").hasclass("cons-title2box")){ var wraps2 = $(".cons-title2box").offset().top; if(wraps2 >= tops){ $(".cons-title2").removeclass('fixed'); $(".bocweb-header2").addclass('fixed onactive'); }else if(wraps2 <= tops){ $(".cons-title2").addclass('fixed'); $(".bocweb-header2").removeclass('fixed onactive'); }; } if($("div").hasclass("con-title-box")){ var wraps2 = $(".con-title-box").offset().top; if(wraps2 >= tops){ $(".con-titles").removeclass('fixed'); $(".bocweb-header2").addclass('fixed onactive'); }else if(wraps2 <= tops){ $(".con-titles").addclass('fixed'); $(".bocweb-header2").removeclass('fixed onactive'); }; } }) function clickvideo(selector){ var video = document.getelementbyid('video'); selector.on('click',function(){ $('.video-fixed').stop(true,true).removeclass('ons').hide(); $('.video-fixed').fadein().delay(500).addclass('ons'); // video.play(); $("html,body").addclass('on-foxed') var videosrc = $(this).attr('data-swf'); $('#video').fadein(500).attr('src',videosrc); }) $('.video-fixed .cha').on('click',function(){ $('.video-fixed').removeclass('ons').delay(500).fadeout(); // video.pause(); $("html,body").removeclass('on-foxed') $('#video').fadeout(500).attr('src',""); }) $(".video-fixed").on("click",function(){ $('.video-fixed').removeclass('ons').delay(500).fadeout(); $("html,body").removeclass('on-foxed') $('#video').fadeout(500).attr('src',""); }) $(".video-fixed .videoboxs").on("click",function(e){ e.stoppropagation() }) } $(function(){ var wow = new wow({ boxclass: 'wow', animateclass: 'animated', offset:20, mobile: true, live: true }); wow.init(); var titleswiper = new swiper('.con-title-swiper .swiper-container',{ pagination : '.con-title-swiper .swiper-pagination', prevbutton:'.swiper-button-prev', nextbutton:'.swiper-button-next', slidesperview: "auto", paginationclickable: true, // autoplay : 6000, slidetoclickedslide:true, autoplaydisableoninteraction: false, lazyloading : true, lazyloadinginprevnext : true, roundlengths : true, uniquenavelements :false, speed:750 }) $(".cons-swiper .swiper-slide").each(function(){ var _width = $(this).innerwidth(); var len = $(this).parents(".cons-swiper").find(".swiper-slide").length; var gs = parseint($(this).parents(".cons-swiper").innerwidth()/_width); var btn = $(this).parents(".cons-swiper").find(".swiper-pagination"); var btn1 = $(this).parents(".cons-swiper").find(".swiper-button-prev"); var btn2 = $(this).parents(".cons-swiper").find(".swiper-button-next"); // console.log(len > gs,len , gs,$(this).parents(".cons-swiper").innerwidth()/_width); if(len > gs){ btn.show(); btn1.show(); btn2.show(); $(this).parents(".swiper-container").removeclass("swiper-no-swiping"); }else{ btn.hide(); btn1.hide(); btn2.hide(); $(this).parents(".swiper-container").addclass("swiper-no-swiping"); } }) $(".bocweb-header2 .header .nav .li").hover( function() { $(this).find(".nav-item").stop(true,true).delay(300).slidedown(400); }, function() { $(this).find(".nav-item").stop(true,true).delay(300).slideup(400); } ); $(".bocweb-header2 .header2 .hamburger").on("click",function(){ if ($(this).hasclass("is-active")) { $(this).removeclass("is-active"); $(".bocweb-header2 .warp-nav").stop(true,false).hide(0); $("body,html").removeclass("ovh-f"); $(".bocweb-header2 .header2 .nav .li").removeclass("animate"); }else{ $(this).addclass("is-active"); $(".bocweb-header2 .warp-nav").stop(true,false).show(0); $("body,html").addclass("ovh-f"); $(".bocweb-header2 .header2 .nav .li").addclass("animate"); } }) var _colspan= $('.bocweb-header2 .header2 .nav .li'); var _len=_colspan.length; var i=0; for(i;i<_len;i++){ _colspan.eq(i).css({ 'transition-delay': 0.1 + 0.04*(i+1)+'s' }); } $(".header2 .sub-tit").on('click', function() { if ($(this).siblings('.sec-list').is(':hidden')){ $(this).addclass('on'); $(this).siblings('.sec-list').stop().slidedown(); $(this).parent().siblings('li').children('.sec-list').stop().slideup().siblings('.tit').removeclass('on'); }else{ $(this).removeclass('on'); $(this).siblings('.sec-list').stop().slideup(); } }); $(".bocweb-header2 .search-btn,.bocweb-header2 .header2 .search-btn").on("click",function(){ $(".bocweb-header2 .warp-search-form").stop().slidedown(300); $(".bocweb-header2 .dxnav__dropdown-overlay").addclass("overlay--open"); $(".bocweb-header2").addclass("active"); }) $(".bocweb-header2 .search-form .search-close,.bocweb-header2 .dxnav__dropdown-overlay").on("click",function(){ $(".bocweb-header2 .warp-search-form").stop().slideup(300); $(".bocweb-header2 .dxnav__dropdown-overlay").removeclass("overlay--open"); if (!$("body").hasclass(".header-por")) { $(".bocweb-header2").removeclass("active"); } }) function mains(id,id1){ $(".bocweb-header2 .header .nav .li").eq(id).addclass("cur"); $(".bocweb-header2 .header .nav .li.cur").find(".nav-item>p").eq(id1).find("a").addclass("cur"); if(!($("body").attr("data-body") == "culturebox")){ $(".con-title-box .itbox").eq(id1).addclass("active"); if($("div").hasclass("con-title-swiper")){ titleswiper.slideto(id1, 0, false); } } } var lg = $("body").attr("data-lg"); var lk = $("body").attr("data-lk"); mains(lg,lk) /* */ $('iframe').hover(function(){ $('.cursor-dot').hide(); },function(){ $('.cursor-dot').show(); }); // 友情链接 $(".linkbox1 .link-title").on("click",function() { $(this).siblings().stop().delay(100).slidetoggle(); }) }) /* ------------------------ cursor ------------------------ */ var cursor = { delay: 3, _x: 0, _y: 0, endx: (window.innerwidth / 2), endy: (window.innerheight / 2), cursorvisible: true, cursorenlarged: false, $outline: document.queryselector('.cursor-dot'), $outsvg: document.queryselector('.cursor-dot svg'), init: function() { // set up element sizes this.outlinesize = this.$outline.offsetwidth; this.setupeventlisteners(); this.animatedotoutline(); }, setupeventlisteners: function() { var self = this; // anchor hovering var hoveitems = document.queryselectorall('a,.js-hover'); hoveritems = array.prototype.slice.call(hoveitems); hoveritems.foreach(function(el) { el.addeventlistener('mouseover', function() { self.cursorenlarged = true; self.togglecursorsize(el); }); el.addeventlistener('mouseout', function() { self.cursorenlarged = false; self.togglecursorsize(); }); }); var hoveitemscolor = document.queryselectorall('.js-hovercolor'); hoveitemscolor = array.prototype.slice.call(hoveitemscolor); hoveitemscolor.foreach(function(el) { el.addeventlistener('mouseover', function() { self.cursorenlarged = true; self.$outline.style.transform = 'translate(-50%, -50%) scale(3)'; self.$outsvg.style.fill = 'rgba(255,255,255,0.5)'; }); el.addeventlistener('mouseout', function() { self.cursorenlarged = false; self.$outline.style.transform = 'translate(-50%, -50%) scale(1)'; self.$outsvg.style.fill = 'rgba(32,96,79,0.5)'; }); }); if($('body').hasclass('welbody')){ $(".i-list1 .itembox1 .text .spbox").lettering("words"); $(".itembox1 .text span").addclass("js-span trans"); } var hoveitemscolor2 = document.queryselectorall('.js-span'); hoveitemscolor2 = array.prototype.slice.call(hoveitemscolor2); hoveitemscolor2.foreach(function(el) { el.addeventlistener('mouseover', function() { self.cursorenlarged = true; self.togglecursorsize(el); self.$outline.style.transform = 'translate(-50%, -50%) scale(3)'; self.$outsvg.style.fill="rgba(206,22,39,0.8)"; console.log(self.$outsvg.style.fill); $(this).css({ 'color':'#333' }) }); el.addeventlistener('mouseout', function() { self.cursorenlarged = false; self.$outline.style.transform = 'translate(-50%, -50%) scale(1)'; self.$outsvg.style.fill = 'rgba(255,255,255,0.5)'; self.togglecursorsize(); $(this).css({ 'color':'#dfdfdf' }) }); }); // click events document.addeventlistener('mousedown', function() { self.cursorenlarged = true; self.togglecursorsize(); }); document.addeventlistener('mouseup', function() { self.cursorenlarged = false; self.togglecursorsize(); }); document.addeventlistener('mousemove', function(e) { // show the cursor self.cursorvisible = true; self.togglecursorvisibility(); // position the dot self.endx = e.clientx; self.endy = e.clienty; }); // hide/show cursor document.addeventlistener('mouseenter', function(e) { self.cursorvisible = false; self.togglecursorvisibility(); self.$outline.style.opacity = 1; }); document.addeventlistener('mouseleave', function(e) { self.cursorvisible = false; self.togglecursorvisibility(); self.$outline.style.opacity = 0; }); }, animatedotoutline: function() { var self = this; self._x += (self.endx - self._x) / self.delay; self._y += (self.endy - self._y) / self.delay; self.$outline.style.left = self._x + 'px'; self.$outline.style.top = self._y + 'px'; requestanimationframe(this.animatedotoutline.bind(self)); }, togglecursorsize: function(el) { var self = this; if (self.cursorenlarged) { self.$outline.style.transform = 'translate(-50%, -50%) scale(3)'; } else { self.$outline.style.transform = 'translate(-50%, -50%) scale(1)'; } }, togglecursorvisibility: function() { var self = this; if (self.cursorvisible) { self.$outline.style.opacity = 1; } else { self.$outline.style.opacity = 0; } } } cursor.init();