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();