/* readyEvent ------------------------------------------------------------------------*/ $(function(){ // タグ切り替え ---------------------------// var $tab = $('#tab'), $li = $tab.find('li'); $li.click(function(){ var target = $(this).attr('data-target'); $(target).addClass('active').siblings('.box_content').removeClass('active'); $(this).addClass('active').siblings().removeClass('active'); }); // smoothScroll ---------------------------// var speed = 1000, easing = 'swing', pcPosition = -0, tabPosition = -0, spPosition = -0; $('a').not('.noscroll').click(function(){ var href = $(this).attr('href'), case1 = href.charAt(0) == '#', case2 = location.href.split('#')[0] == href.split('#')[0]; if(case1 || case2) { if(case2) href = '#'+href.split('#')[1]; $target = $(href); if($target.length){ $html.add($body).not(':animated').animate({scrollTop : String($target.offset().top + (abi.pc ? pcPosition : abi.tab ? tabPosition : spPosition))},speed,easing); return false; } } }); // outerPageAnchorLink ---------------------------// if(window.location.href.split('#')[1] == undefined || window.location.href.split('#')[1].indexOf('=') == -1) { var $target = $('#'+window.location.href.split('#')[1]), adjust = (abi.pc) ? pcPosition : (abi.tab) ? tabPosition : spPosition; if($target.length) { $w.load(function(){ var targetPosition = $target.offset().top; $html.add($body).animate({scrollTop: String(targetPosition + adjust)}, 10); }); } } }); // header scroll ---------------------------// $(function() { var $header = $('.global_header'), headerClone = $header.clone().addClass('clone').appendTo('body'), headerWrap = $('.header').outerHeight(), footerHeight = $('.footer').outerHeight(), docmentHeight = $(document).height(), hideClass = 'is-hide', showClass = 'is-show'; $w.on('load scroll', function() { if (abi.pc || abi.tab) { var value = $(this).scrollTop(), scrollPos = $w.height() + value; if ( value > headerWrap ) { if ( docmentHeight - scrollPos <= footerHeight ) { headerClone.addClass(hideClass); } else { headerClone.removeClass(hideClass); } headerClone.addClass(showClass); } else { headerClone.removeClass(showClass); } } }); }); // language ---------------------------// $(function(){ $('.header_lang .language').mouseenter(function(){ $(this).find('dd').not(':animated').slideDown(300); }).mouseleave(function(){ $(this).find('dd').slideUp(300); }); }); // modal ---------------------------// $(function(){ var $window = $(window), $html = $('html'), $body = $('body'), $overlay = $('.overlay'), scrollbarWidth = window.innerWidth - document.body.scrollWidth, touchStart_y; $window.on('touchstart', function(event) { touchStart_y = event.originalEvent.changedTouches[0].screenY; }); $('.js-modal-button').on({ 'click':function(){ $window.on('touchmove.noscroll', function(event) { var overlay = $overlay[0], current_y = event.originalEvent.changedTouches[0].screenY, height = $overlay.outerHeight(), is_top = touchStart_y <= current_y && overlay.scrollTop === 0, is_bottom = touchStart_y >= current_y && overlay.scrollHeight - overlay.scrollTop === height if (is_top || is_bottom) { event.preventDefault(); } }); $('html, body').css('overflow', 'hidden'); if (scrollbarWidth) { $html.css('padding-right', scrollbarWidth); } $($(this).data('target')).fadeIn(300); $body.toggleClass('js-modal-open'); } }); var closeModal = function() { $body.removeAttr('style'); $body.removeClass('js-modal-open'); $window.off('touchmove.noscroll'); $overlay.animate({ opacity: 0 }, 300, function() { $overlay.scrollTop(0).hide().removeAttr('style'); $html.removeAttr('style'); }); }; $overlay.on('click', function(event) { if (!$(event.target).closest('.modal').length) { closeModal(); } }); $('.js-close-button').on('click', function() { closeModal(); }); }); $('.accordion').click(function(){ if(!$(this).is('.sp_only') || $(this).is('.sp_only') && abi.sp) { var $next = $(this).next(); if(!$next.is(':animated')) $next.slideToggle(300).prev().toggleClass('active'); } }); $(function(){ var $arrows = $('.arrows'); //main_slider $('#mv-slider').on('init', function(event, slick){ $('#mv-slider .current').text(slick.currentSlide + 1); $('#mv-slider .total').text(slick.slideCount); }).slick({ arrows: false, fade: true, dots: true, autoplay: true, autoplaySpeed: 1500, speed: 3000, appendArrows: $('#mv-slider .box_thum').find($arrows), prevArrow: '
', nextArrow: '
', }).on('beforeChange', function(event, slick, currentSlide, nextSlide){ $('#mv-slider .current').text(nextSlide + 1); }); });