
$('.settings__bnt').on('click', function (e) {
    $(this).parent().toggleClass('settings__act');

    $('.head-clock').removeClass('head-clock__act');
    $('.head-lang').removeClass('head-lang__act')
    $('.head-stock').removeClass('head-stock__act');


    e.stopPropagation();
});

$('.settings__drop ul li').on('click', function () {
    let text_in = $('.open-settings').html();
    let selected_text = $(this).html();
    $('.open-settings').html(selected_text);

    $(this).html(text_in)
    $('.settings__cnt').removeClass('settings__act')
});
$(window).on('click', function (e) {
    let menuSort = $('.settings__cnt');
    if (e.target !== menuSort) {
        menuSort.removeClass('settings__act');
    }
});


$('.head-clock__btn').on('click', function (e) {
    $(this).parent().toggleClass('head-clock__act');

    $('.settings__cnt').removeClass('settings__act');
    $('.head-lang').removeClass('head-lang__act')
    $('.head-stock').removeClass('head-stock__act');


    e.stopPropagation();
});


$(window).on('click', function (e) {
    let clock = $('.head-clock');
    if (e.target !== clock) {
        clock.removeClass('head-clock__act');
    }
});









$('.head-lang__btn').on('click', function (e) {
    $(this).parent().toggleClass('head-lang__act');
    $('.head-clock').removeClass('head-clock__act');
    $('.settings__cnt').removeClass('settings__act');
    $('.head-stock').removeClass('head-stock__act');

    e.stopPropagation();

});

// $('.head-clock__crist ul li').on('click', function () {
//     let text_in = $('.lang-round').html();
//     let selected_text = $(this).html();
//     $('.lang-round').html(selected_text);
//     $(this).html(text_in)
//     $('.head-lang').removeClass('head-lang__act')
// });


$(window).on('click', function (e) {
    let headLang = $('.head-lang');
    if (e.target !== headLang) {
        headLang.removeClass('head-lang__act');
    }
});



$('.head-stock__btn').on('click', function (e) {
    $(this).parent().toggleClass('head-stock__act');

    $('.head-lang').removeClass('head-lang__act');
    $('.head-clock').removeClass('head-clock__act');
    $('.settings__cnt').removeClass('settings__act');

    e.stopPropagation();
});
$(window).on('click', function (e) {
    let headStock = $('.head-stock');
    if (e.target !== headStock) {
        headStock.removeClass('head-stock__act');
    }
});




let gamesSwiper = new Swiper(".main-glob__slider", {
    slidesPerView: 1,
    loop: true,
    effect: "coverflow",
    grabCursor: true,
    autoplay: {
        delay: 3000,
        disableOnInteraction: false,
    },
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    },
});



$(function () {
    var Accordion = function (el, multiple) {
        this.el = el || {};
        this.multiple = multiple || false;
        var links = this.el.find('.link');
        links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
    };

    Accordion.prototype.dropdown = function (e) {
        var $el = e.data.el;
        $this = $(this),
            $next = $this.next();

        $next.slideToggle();


        if (!e.data.multiple) {

            $el.find('.submenu').not($next).slideUp();
        }

        if (!$this.hasClass('open')) {
            $('.link').each(function () {
                $(this).removeClass('open')
            })
            $this.addClass('open')
        } else {
            $this.removeClass('open')
        }
    }

    var accordion = new Accordion($('#accordion'), false);
});



$('.open-menu').on('click', function () {
    $('.head-mob__block').addClass('head-mob__act');
    $('body').addClass('body-fix');
});

$('.close-menu').on('click', function () {
    $('.head-mob__block').removeClass('head-mob__act');
    $('body').removeClass('body-fix');
});
