Blame view
public/js_/script.js
3.87 KB
b6103c749 Обновление js и c... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
let scripts = function () { $('.js-toggle').on('click', function () { $(this).toggleClass('active'); }); $('.js-parent-toggle').on('click', function () { $(this).parent().toggleClass('active'); }); $('.js-parent-remove').on('click', function () { $(this).parent().remove(); }); $('.js-menu-toggle').on('click', function () { window.scrollTo(0,0); $('#body').toggleClass('menu-is-actived'); }); $('.js-cookies-close').on('click', function () { $('#body').removeClass('cookies-is-actived'); }); $('.js-works-edit').on('click', function () { $(this).parent().parent().parent().addClass('active'); }); $('.js-works-remove').on('click', function () { $(this).parent().parent().parent().parent().remove(); }); $('[data-tab]').on('click',function(){ $('[data-tab]').removeClass('active'); $('[data-body]').removeClass('showed'); $(this).addClass('active'); var id = $(this).data('tab'); $('[data-body='+id+']').addClass('showed'); }); $('.js-password-show').on('click',function(){ $(this).parent().addClass('active'); $(this).parent().parent().find('input').attr('type','text'); }); $('.js-password-hide').on('click',function(){ $(this).parent().removeClass('active'); $(this).parent().parent().find('input').attr('type','password'); }); let checkScrollTop = function () { if ($(document).scrollTop() == 0) { $('#body').removeClass('begin'); } else { $('#body').addClass('begin'); } } checkScrollTop(); $(document).on('scroll', function () { checkScrollTop(); }); let closeAll = function () { $('.js-toggle').removeClass('active'); $('.js-parent-toggle').parent().removeClass('active'); $('#body').removeClass('menu-is-actived'); $('#body').removeClass('cookies-is-actived'); } $(document).keyup(function (e) { if (e.key === "Escape") { closeAll(); } }); $('.js-scroll-to').bind('click', function (e) { let anchor = $(this); $('html,body').stop().animate({ scrollTop: $(anchor.attr('href')).offset().top }, 300); e.preventDefault(); }); if ($('[type=tel]').is('[type=tel]')){ $('[type=tel]').mask('+7 (999) 999-99-99'); } if ($('.js-select2').is('.js-select2')){ $('.js-select2').select2(); } }; let swipers = function () { if ($('.js-employer-swiper').is('.js-employer-swiper')) { let slider = new Swiper('.js-employer-swiper', { autoplay: { delay: 5000, }, pagination: { el: '.swiper-pagination', clickable: true }, breakpoints: { 768: { slidesPerView: 2, }, 992: { slidesPerView: 3, }, 1280: { slidesPerView: 4, }, } }); } if ($('.js-news-swiper').is('.js-news-swiper')) { let slider = new Swiper('.js-news-swiper', { spaceBetween: 20, pagination: { el: '.swiper-pagination', clickable: true }, navigation: { prevEl: '.js-news-swiper-button-prev', nextEl: '.js-news-swiper-button-next', }, breakpoints: { 768: { slidesPerView: 2, }, 992: { slidesPerView: 3, }, } }); } }; document.addEventListener("DOMContentLoaded", () => { scripts(); swipers(); }); $(window).resize(function () { swipers(); }); |