$(function () { /* ボタンの追従 */ function FixedAnime() { var heroTarget = $('.entry'); heroOffset = heroTarget.offset(); $(window).scroll(function () { if ($(window).scrollTop() > heroOffset.top) { heroTarget.addClass('fixed'); } else { heroTarget.removeClass('fixed'); } }); } $(window).on('load', function () { FixedAnime(); }); /* モーダルウィンドウ */ $('.modal').click(function () { $('body').append('
'); $('.overlay').fadeIn(300); $(this).parents('.entry, .item').next('.modal-contents').fadeIn(300); $("html,body").css('overflow','hidden'); return false; }); $('body,.close-text').click(function () { $('.overlay').fadeOut(300, function () { $('.overlay').remove(); }); $('.modal-contents').fadeOut() $("html,body").css('overflow','auto'); }); /* アコーディオン */ $('.accordion .btn').click(function () { $(this).next().slideToggle(300); $(this).toggleClass('open'); }); /* タブ切替 */ $('.tab-btn a').on('click', function() { $('.tab-btn a').removeClass('active'); $('.tab').removeClass('active'); $(this).addClass('active'); var Id = "#" + $(this).attr('id') + "-content"; $(Id).addClass('active'); }); });(jQuery);