3 let button = $('.js-menu');
4 let menu = $('.l-navigation__menu');
5 let menuLinks = menu.find('a');
7 button.on('click', function() {
8 if(!$(this).hasClass('is-active')) {
9 $(this).addClass('is-active');
10 menu.addClass('is-open');
11 button.find('.bar').addClass('animate');
12 menuLinks.attr('tabindex', 0);
14 $(this).removeClass('is-active');
15 menu.removeClass('is-open');
16 button.find('.bar').removeClass('animate');
17 menuLinks.attr('tabindex', -1);
21 $(document).keyup(function(e) {
22 if (e.keyCode === 27) {
23 button.removeClass('is-active');
24 menu.removeClass('is-open');
25 button.find('.bar').removeClass('animate');
26 menuLinks.attr('tabindex', -1);
31 // Ebook/Audiobook Btns
33 let button = $('.c-media__btn button');
34 let closeButton = $('.c-media__popup__close');
36 button.on('click', function () {
37 let target = $(this).attr('id');
38 $('[data-popup=' + target).addClass('is-open');
41 closeButton.on('click', function() {
42 $(this).closest('.c-media__popup').removeClass('is-open');
45 $(document).keyup(function(e) {
46 if (e.keyCode === 27) {
47 $('.c-media__popup').removeClass('is-open');
52 // Text overlay toggler
54 let overlays = $('.l-article__overlay');
55 let button = $('.l-article__read-more');
57 overlays.each(function () {
58 let maxHeight = $(this).attr('data-max-height');
59 if($(this).outerHeight() > maxHeight) {
60 $(this).css({'maxHeight': maxHeight+'px'}).addClass('is-active');
62 $(this).next('.l-article__read-more').hide();
66 button.on('click', function() {
67 let dataLabel = $(this).attr('data-label');
68 let dataAction = $(this).attr('data-action');
69 $(this).parent().find('.l-article__overlay').toggleClass('is-clicked');
70 if($(this).text() === dataLabel) {
71 $(this).text(dataAction);
73 $(this).text(dataLabel);
78 //Zmieniamy siÄ™ popup
80 let $change = $('.l-change-pop');
82 if(localStorage.getItem('change') === null) {
83 $change.addClass('show');
89 $change.on('click', '.l-change-pop__close', function () {
91 localStorage.setItem('change', 'showed');
95 if($change.length) { change(); }